using System.Collections; using System.Collections.Generic; using UnityEngine; public class MovieScreen : MonoBehaviour { [SerializeField] private UnityEngine.Video.VideoPlayer mPlayer; [SerializeField] private GameObject ExtralObj;//附带的显示 private MeshRenderer mRender; void Awake() { mRender = this.gameObject.GetComponent(); } private void OnEnable() { mRender.enabled = false; if(ExtralObj != null) { ExtralObj.SetActive(false); } StartCoroutine(CheckMovie()); } IEnumerator CheckMovie() { yield return null; while(!mPlayer.isPlaying) { //CDebug.Log("-->" + mRender.material.mainTexture); yield return new WaitForSecondsRealtime(1); } mRender.enabled = true; if (ExtralObj != null) { ExtralObj.SetActive(true); } } }