Hi guys!
I want to show a progress bar until Reward Based Video is loading and then showing but LoadRewardBasedAd i a void type so it does not return. How can i do the operation? Thanks for your help.
private void LoadRewardBasedAd()
{
#if UNITY_EDITOR
string adUnitId = "unused";
#elif UNITY_ANDROID
string adUnitId = "ca-app-pub-3940256099942544/5224354917";
#elif UNITY_IPHONE
string adUnitId = "ca-app-pub-3940256099942544/5224354917";
#else
string adUnitId = "unecpected platfrom";s
#endif
rewardBasedVideoAd.LoadAd(new AdRequest.Builder().Build(), adUnitId);
}
private void ShowRewardBasedAd()
{
if(rewardBasedVideoAd.IsLoaded())
{
rewardBasedVideoAd.Show();
}
}
IEnumerator LoadAsynchoronously()
{
AsyncOperation operation = LoadRewardBasedAd();
while(!operation.isDone)
{
Debug.Log(operation.progress);
yield return null;
}
}
↧