PlaneRun/Assets/Scripts/GoogleMobileAdsScript.cs

32 lines
859 B
C#

using GoogleMobileAds;
using GoogleMobileAds.Api;
using GoogleMobileAds.Sample;
using System;
using UnityEngine;
public class GoogleMobileAdsScript : MonoBehaviour
{
[SerializeField] RewardedAdController rewardedAdController;
[SerializeField] InterstitialAdController InterstitialAdController;
[SerializeField] shopManager shopManager;
// Start is called before the first frame update
void Start()
{
// Initialize the Google Mobile Ads SDK.
MobileAds.Initialize((InitializationStatus initStatus) =>
{
// This callback is called once the MobileAds SDK is initialized.
rewardedAdController.LoadAd();
InterstitialAdController.LoadAd();
shopManager.EnableRewardedAdButton(true);
});
MobileAds.RaiseAdEventsOnUnityMainThread = true;
}
}