/// <summary> /// 每隔 1.0f / 26 秒播放一帧动画 /// </summary> IEnumerator Display() { while (true) { byte[] videoData = LibCSV.GetCurrentVideoData(); if (tex != null && videoData != null) { if (videoData.Length == tex.width * tex.height * 4) { tex.LoadRawTextureData(videoData); tex.Apply(); LibCSV.SetWrite(); } } yield return(new WaitForSeconds(1.0f / 26)); } }
void Update() { mTimer = mTimer - Time.deltaTime; if (mTimer < 0) { mTimer = 0.1f; if (libcsv != null) { Byte[] videoData = LibCSV.GetCurrentVideoData(); if (txt2dtest != null && videoData != null) { if (videoData.Length == txt2dtest.width * txt2dtest.height * 4) { txt2dtest.LoadRawTextureData(videoData); txt2dtest.Apply(); LibCSV.SetWrite(); } } } } }