В редакторе юнити при запуске игры реклама показывается.
Выложил в плей маркет и ничего нет!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using GoogleMobileAds.Api;
public class click : MonoBehaviour
{
// Start is called before the first frame update
public int persikint;
public Text text;
public int clicks;
private RewardedAd rewardedAd;
public void Start()
{
MobileAds.Initialize(initStatus => { });
string adUnitId;
#if UNITY_ANDROID
adUnitId = "Скрыл";
#elif UNITY_IPHONE
adUnitId = "Не пользуюсь";
#else
adUnitId = "unexpected_platform";
#endif
this.rewardedAd = new RewardedAd(adUnitId);
// Create an empty ad request.
AdRequest adrequest = new AdRequest.Builder().Build();
// Load the rewarded ad with the request.
this.rewardedAd.LoadAd(adrequest);
}
void Update()
{
if (clicks == 100)
{
if (this.rewardedAd.IsLoaded())
{
this.rewardedAd.Show();
}
clicks = 0;
}
print(
PlayerPrefs.GetInt("persik")
);
text.text = "" + PlayerPrefs.GetInt("persik");
}
void OnClick()
{
PlayerPrefs.SetInt("persik", PlayerPrefs.GetInt("persik") + 1);
clicks++;
}
public void HandleRewardedAdFailedToShow(object sender, AdErrorEventArgs args)
{
MonoBehaviour.print(
"HandleRewardedAdFailedToShow event received with message: "
+ args.Message);
}
public void HandleRewardedAdFailedToLoad(object sender, AdErrorEventArgs args)
{
MonoBehaviour.print(
"HandleRewardedAdFailedToLoad event received with message: "
+ args.Message);
}
}