Code (CSharp):
- using UnityEngine;
- using System.Collections;
- using UnityEngine.Advertisements;
- public class NewBehaviourScript : MonoBehaviour {
- void Start ()
- {
- Advertisement.Initialize ("1042635", true);
- }
- public void Buton()
- {
- StartCoroutine (ShowAdWhenReady());
- }
- IEnumerator ShowAdWhenReady()
- {
- while (!Advertisement.isReady())
- yield return null;
- Advertisement.Show ();
- }
- }