- Home /
Question by
Grimstborith · Oct 27, 2017 at 11:30 AM ·
unity 5adsprogress-bar
Loading Bar Until Ad Show Up
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;
}
}
Comment
Your answer
Follow this Question
Related Questions
unity ads work fine in the editor but on my phone it doesn't give me an ad 0 Answers
Game App Crashes when Application.Quit() 0 Answers
Androidmanifest for ads 0 Answers
Unity Mediation Plug-In breaks the game with infinite Resolving Android Dependencies 0 Answers
startapp 3.1 reward video integration 2 Answers