12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- 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<MeshRenderer>();
- mPlayer = mRender.GetComponent<VideoPlayer>();
- mPlayer.clip = Resources.Load<VideoClip>("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<MeshRenderer>();
- // // mPlayer = transform.Find("Video").GetComponent<VideoPlayer>();
- //// mPlayer = mRender.GetComponent<VideoPlayer>();
- // 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<VideoPlayer>();
- }
- 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);
- // }
- //}
- }
|