java - Unity Ads Android Integration - Reloading Video Ad issue -


i have integrated unity ads android library android project. @ beginning, after calling init

unityads.init(this, consts.unity_game_id, this); 

onfetchcompleted method of callback called , can show video , callback completion on activity.

i want reload video after completion , looking method "reload", "fetch" etc. on unityads class. seems there no way this.

so, have tried call unityads.init again, couldn't callback or error on logs.

how can reload video ad?

1. don't call init twice.

2. not using isready check if ad read shown before calling advertisement.show() function.

copied directly unity website, code below should show ad , wait show ad, call showad() again.

[serializefield] string gameid = "33675";  void awake() {     advertisement.initialize (gameid, true); }  void start() {     showad();//show ad }  public void showad(string zone = "") {     #if unity_editor         startcoroutine(waitforad ());     #endif      if (string.equals (zone, ""))         zone = null;      showoptions options = new showoptions ();     options.resultcallback = adcallbackhandler;      if (advertisement.isready (zone))         advertisement.show (zone, options); }  void adcallbackhandler (showresult result) {     switch(result)     {     case showresult.finished:         debug.log ("ad finished. rewarding player...");         break;     case showresult.skipped:         debug.log ("ad skipped. son, dissapointed in you");         break;     case showresult.failed:         debug.log("i swear has never happened me before");         break;     } }  ienumerator waitforad() {     float currenttimescale = time.timescale;     time.timescale = 0f;     yield return null;      while (advertisement.isshowing)         yield return null;      time.timescale = currenttimescale; } 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -