// Use this for initialization void Start() { ShowAdButton.onClick.AddListener(OnShowAdButtonClicked); vrAd = new VRAd(1); vrAd.AdStatusChanged += OnAdStatusChanged; vrAd.LoadAd(); }
// Use this for initialization void Start() { Debug.Log("OmniVirt SDK Version v" + OmniVirt.SDK.SDK_VERSION); ShowAdButton.onClick.AddListener(OnShowAdButtonClicked); vrAd = new VRAd(1); vrAd.AdStatusChanged += OnAdStatusChanged; vrAd.LoadAd(); }
IEnumerator ReloadAd() { yield return(null); if (vrAd != null) { vrAd.Unload(); vrAd = null; } vrAd = new VRAd(1); vrAd.AdStatusChanged += OnAdStatusChanged; vrAd.LoadAd(); }
void OnAdStatusChanged(object sender, AdStatusChangedEventArgs e) { AppendLog("AdState Changed to " + e.Status.ToString()); if (vrAd.IsLoaded()) { // Enable Show Ad button once ad is ready ShowAdButton.interactable = true; } else if (vrAd.IsCompleted()) { // Reload an ad for next session vrAd.LoadAd(); // Disable Show Ad button while loading ShowAdButton.interactable = false; } }