void Start() { Time.timeScale = 0; if (File.Exists(adsData.GetAdsPath())) { videoPlayer.url = adsData.GetAdsPath(); videoPlayer.Play(); } StartCoroutine(DelayEnableBtn()); }
void Start() { Time.timeScale = 0; if (File.Exists(adsData.GetAdsPath())) { var fileData = File.ReadAllBytes(adsData.GetAdsPath()); var tex = new Texture2D(2, 2); tex.LoadImage(fileData); adsImage.texture = tex; } else { adsImage.gameObject.SetActive(false); } }
private IEnumerator CacheElement(AdsElement element) { UnityWebRequest www = UnityWebRequest.Get(element.url); yield return(www.SendWebRequest()); if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { try { System.IO.File.WriteAllBytes(element.GetAdsPath(), www.downloadHandler.data); } catch (Exception e) { Debug.Log("Fail to cache ads" + e.Message); } } }