Skip to content

Instantly share code, notes, and snippets.

@jcguarinpenaranda
Last active August 29, 2015 14:26
Show Gist options
  • Save jcguarinpenaranda/600c45760112f47a82cb to your computer and use it in GitHub Desktop.
Save jcguarinpenaranda/600c45760112f47a82cb to your computer and use it in GitHub Desktop.
Show Ads when Unity game starts
using UnityEngine;
using System.Collections;
using UnityEngine.Advertisements;
public class SimpleAds : MonoBehaviour
{
//Change to your gameID code in
//unityads.unity3d.com
string gameID = "33675";
void Start ()
{
Advertisement.Initialize (gameID, true);
StartCoroutine (ShowAdWhenReady());
}
IEnumerator ShowAdWhenReady()
{
while (!Advertisement.isReady())
yield return null;
Advertisement.Show ();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment