Quantcast
Channel: Questions in topic: "ads"
Viewing all articles
Browse latest Browse all 1416

UnityAds not initailising on android device

$
0
0
Good Day, I have been trying to get UnityAds to work on my device for testing, they used to work but no longer do. After some testing I have found that it is not initialising on my device. In the editor it works and gives the demo screen when tested but once it is on the device it no longer initialises. My script (attached to a component called AdController): using System; using UnityEngine; using UnityEngine.UI; using UnityEngine.Advertisements; public class AdController : MonoBehaviour { public string myAppID; public bool adTestMode; public Text adTester; void Start() { if (Advertisement.isSupported) { Advertisement.allowPrecache = true; Advertisement.Initialize (myAppID, adTestMode); } else { Debug.Log("Platform not supported"); } } public void ShowAd() { adTesterText.text = "Ad = " + Advertisement.isInitialized.ToString (); if(Advertisement.isReady()) { Advertisement.Show(null, new ShowOptions { pause = true, resultCallback = result => { Debug.Log(result.ToString()); } }); } } } I set up adTesterText to display on the game screen whether Advertisement is initialised, and this returns false only on the device. This runs once the player dies before the "stats" screen.

Viewing all articles
Browse latest Browse all 1416

Trending Articles