ads fixed
This commit is contained in:
@@ -23,6 +23,11 @@ public class AdsManager : MonoBehaviour
|
||||
[SerializeField]private string interstitialId;
|
||||
[SerializeField]private string rewardedId;
|
||||
|
||||
[Header("Ids apple")]
|
||||
[SerializeField]private string ios_bannerId;
|
||||
[SerializeField]private string ios_interstitialId;
|
||||
[SerializeField]private string ios_rewardedId;
|
||||
|
||||
public UnityEvent onAwardEarned = new UnityEvent();
|
||||
|
||||
|
||||
@@ -56,11 +61,12 @@ public class AdsManager : MonoBehaviour
|
||||
SceneManager.LoadScene("Login");
|
||||
Debug.Log("Google ads init,"+initStatus);
|
||||
Debug.Log("Loading ads now");
|
||||
rewardedAd = new RewardedAd(rewardedId);
|
||||
rewardedAd = new RewardedAd((Application.platform == RuntimePlatform.IPhonePlayer) ?ios_rewardedId :rewardedId);
|
||||
rewardedAd.OnUserEarnedReward += OnRewardedComplete;
|
||||
rewardedAd.OnAdFailedToLoad += OnRewardedFailed;
|
||||
rewardedAd.OnAdFailedToShow += OnRewardedFailed;
|
||||
interstitial.OnAdClosed += OnInterestitialClosed;
|
||||
|
||||
|
||||
// RequestBanner();
|
||||
LoadInterestitial();
|
||||
LoadRewarded();
|
||||
@@ -78,13 +84,15 @@ public class AdsManager : MonoBehaviour
|
||||
}
|
||||
|
||||
void RequestBanner(){
|
||||
bannerView = new BannerView(bannerId, AdSize.Banner, AdPosition.BottomLeft);
|
||||
bannerView = new BannerView((Application.platform == RuntimePlatform.IPhonePlayer) ? ios_bannerId : bannerId, AdSize.Banner, AdPosition.BottomLeft);
|
||||
AdRequest request = new AdRequest.Builder().Build();
|
||||
this.bannerView.LoadAd(request);
|
||||
}
|
||||
|
||||
void LoadInterestitial(){
|
||||
interstitial = new InterstitialAd(interstitialId);
|
||||
interstitial = new InterstitialAd((Application.platform == RuntimePlatform.IPhonePlayer) ? ios_interstitialId : interstitialId);
|
||||
interstitial.OnAdClosed += OnInterestitialClosed;
|
||||
|
||||
// Create an empty ad request.
|
||||
AdRequest request = new AdRequest.Builder().Build();
|
||||
// Load the interstitial with the request.
|
||||
|
||||
Reference in New Issue
Block a user