Pro_Unit

GoogleAdsHandler

May 13th, 2021
865
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3. using GoogleMobileAds.Api;
  4. using UnityEngine;
  5.  
  6. public class GoogleAdsHandler : MonoBehaviour
  7. {
  8.     private InterstitialAd _interstitial;
  9.     public static SynchronizationContext MainThread;
  10.  
  11.     private void Awake()
  12.     {
  13.         MainThread = SynchronizationContext.Current;
  14.         DontDestroyOnLoad(this);
  15.     }
  16.  
  17.     private void Start()
  18.     {
  19.         if (GoogleAds.Instance.Initialized) return;
  20.  
  21.         MobileAds.Initialize(GoogleAds.Instance.InitCompleteAction);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment