private IEnumerator _ShowAd() { button.enabled = false; _error = false; var now = DateTime.UtcNow; while (!_ad.IsReady && (DateTime.UtcNow - now).TotalSeconds < loadTimeout) { _loading = true; RefreshUi(); _ad.CheckReload(); yield return(new WaitForSeconds(0.5f)); } _loading = false; _error = !_ad.IsReady; RefreshUi(); if (!_error) { _ad.ShowOnResult(_OnResult); } button.enabled = true; }
private void OnEnable() { _ad?.CheckReload(); }