123456789101112131415161718192021222324252627282930313233343536373839404142 |
- 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<MeshRenderer>();
- }
- 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);
- }
- }
- }
|