Quantcast
Channel: Questions in topic: "unityandroid"
Viewing all articles
Browse latest Browse all 38

Unity Ads is working in editor but not on android device

$
0
0
I got Unity Ads to work in the editor, when the ad is triggered i get "Here should be your ad unit (things seem to be working)" but when i trigger the ad on my device, the sceen goes black and the app restarts completely(showing the unity logo again) Here is the part of my script that does the ads: using UnityEngine.Advertisements; public class GameController : MonoBehaviour { //For Ads private const int counterReset = 2; public static int counterForAds = counterReset; void Awake() { if(Advertisement.isSupported){ Advertisement.allowPrecache = true; Advertisement.Initialize("32885", false); } } public static void resetCounter(){ counterForAds = counterReset; } public void GameOver() { StopAllCoroutines(); gameOverText.text = "Game Over!"; gameOverText.enabled = true; if(score > PlayerPrefs.GetInt("Score")) { PlayerPrefs.SetInt("Score", score); } counterForAds--; if(counterForAds <= 0){ resetCounter(); Advertisement.Show (null, new ShowOptions { pause = true, resultCallback = ShowResult => { StartCoroutine(Restart ()); } }); } else { StartCoroutine(Restart ()); //This Coroutine restarts the scene } } } i'm guessing you guys might need additional information, if so please tell me and/or guide me how to find that info because i'm new to this :) Thank you in advance

Viewing all articles
Browse latest Browse all 38

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>