using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Video; public class MovieScreen : MonoBehaviour { [SerializeField] private UnityEngine.Video.VideoPlayer mPlayer; [SerializeField] private GameObject ExtralObj;//附带的显示 [SerializeField] private MeshRenderer mRender; void Start() { mRender = transform.Find("movie_logo").GetComponent(); mPlayer = mRender.GetComponent(); mPlayer.clip = Resources.Load("movie_ani/logo_movie_base"); mRender.gameObject.SetActive(false); mRender.gameObject.SetActive(true); mPlayer.Play(); // ExtralObj = transform.GetChild(0).gameObject; // mRender = transform.Find("movie_logo").GetComponent(); // // mPlayer = transform.Find("Video").GetComponent(); //// mPlayer = mRender.GetComponent(); // mPlayer.targetMaterialRenderer = mRender; // //mRender.enabled = false; // //if (ExtralObj != null) // //{ // // ExtralObj.SetActive(false); // //} // //StartCoroutine(CheckMovie()); // //if (mPlayer == null) // // return; // //mRender.enabled = true; // ////if (ExtralObj != null) // ////{ // //// ExtralObj.SetActive(false); // ////} // //ExtralObj.SetActive(true); // //mPlayer.Play(); // StartCoroutine(Player()); } private IEnumerator Player() { mPlayer.enabled = false; yield return new WaitForSeconds(1f); mPlayer.gameObject.AddComponent(); } private void Update() { // mPlayer.Play(); } //private void OnEnable() //{ // if (mPlayer == null) // return; // mRender.enabled = true; // //if (ExtralObj != null) // //{ // // ExtralObj.SetActive(false); // //} // ExtralObj.SetActive(true); // mPlayer.Play(); // // 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); // } //} }