- Home /
Question by
Naktrem · Aug 22, 2018 at 01:52 PM ·
androidiosandroid buildscene-loadingissue
Android build not working properly
Hello there, I just finished my game and build it on android and iOS. Everything is working fine on iOS and in the editor but on Android, Scene is not loading after the rewarded ad is successfully finished. I put some code for context.
public void Continue(){
Debug.Log(PlayerPrefs.GetInt("GameOverCounter") + name);
if (Advertisement.IsReady () && PlayerPrefs.GetInt ("AdCounter") == 0) {
Advertisement.Show ("rewardedVideo", new ShowOptions () { resultCallback = HandleAdStatus });
} else {
//Debug.Log ("Ad Already Played!!");
}
}
private void HandleAdStatus(ShowResult res) {
switch (res) {
case ShowResult.Finished:
PlayerPrefs.SetInt("isAdWatched", 1);
LoadPlay("Continue");
break;
case ShowResult.Skipped:
break;
case ShowResult.Failed:
break;
}
}
public void LoadPlay(string name){
animPlay = true;
Debug.Log (PlayerPrefs.GetInt ("GameOverCounter") + name);
Invoke("DelayPlay", 2);
Invoke("DelayDestroy", 5);
if (PlayerPrefs.GetInt ("GameOverCounter") == 0) {
PlayerPrefs.SetInt ("GameOverCounter", PlayerPrefs.GetInt ("GameOverCounter")+1);
}
else if(name == "Restart"){
PlayerPrefs.SetInt ("AdCounter",0);
PlayerPrefs.SetInt ("GameOverCounter", 0);
}
else {
PlayerPrefs.SetInt ("AdCounter",1);
PlayerPrefs.SetInt ("GameOverCounter", 1);
}
}
void DelayPlay(){
SceneManager.LoadScene ("Slide Out");
//Destroy (animCube);
}
void DelayDestroy(){
Destroy (animCube);
}
Comment