Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. using UnityEngine;
  2. using UnityEngine.Advertisements;
  3. using System.Collections;
  4.  
  5. public class SimpleAdScript : MonoBehaviour
  6. {
  7. void ShowUnityAd()
  8. {
  9. #if UNITY_ANDROID
  10. Advertisement.Initialize ("IDANDROID", true);
  11. #elif UNITY_IPHONE
  12. Advertisement.Initialize ("IDIOS", true);
  13. #endif
  14.  
  15. StartCoroutine (ShowAdWhenReady ());
  16. }
  17.  
  18. IEnumerator ShowAdWhenReady()
  19. {
  20. while (!Advertisement.isReady ())
  21. yield return null;
  22.  
  23. Advertisement.Show ();
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement