- Home /
Question by
BadwolfX · Jan 20, 2018 at 09:05 PM ·
androidadvertisingwontwork
Advert wont play
Hello, I have this code below, without the "Advertisement.Show()" and the "IsReady()" parts the script runs perfectly however adding these bits, which I thought would work, stops the whole code from working including the going back to menu??? - Many Thanks, Will :)
using System.Collections;
using System.Collections.Generic;
using UnityEngine.Advertisements;
using UnityEngine;
public class Quitting : MonoBehaviour
{
private void Awake()
{
if (Advertisement.isSupported)
{
if (Application.platform == RuntimePlatform.Android)
{
Advertisement.Initialize("1668947", false);
}
}
}
void Update()
{
if (Application.platform == RuntimePlatform.Android)
{
if (Input.GetKey(KeyCode.Escape))
{
if(Advertisement.IsReady())
{
Advertisement.Show();
Application.LoadLevel(0);
return;
}
}
}
}
}
Comment