12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Video;
- public class VideoGCController : MonoBehaviour
- {
- [SerializeField]
- private VideoPlayer Video;
- [SerializeField]
- private GameObject Screen;
- [SerializeField]
- private GameObject CheckObj;
- private void Awake()
- {
- CheckObj.gameObject.SetActive(false);
- Screen.gameObject.SetActive(true);
- Video.gameObject.SetActive(true);
- }
- void Start()
- {
- Video.Play();
- StartCoroutine(VideoCallBack(Video));
- }
- private IEnumerator VideoCallBack(VideoPlayer VideoObject)
- {
- yield return new WaitForSeconds(1);
- while (VideoObject.isPlaying)
- {
- yield return new WaitForFixedUpdate(); //跟FixedUpdate 一样根据固定帧 更新
- }
- CDebug.Log("视频播放完毕");
- CheckObj.gameObject.SetActive(true);
- Screen.gameObject.SetActive(false);
- Destroy(this.gameObject);
- }
- }
|