场景搭建
2.按钮播放视频这部分写一个按钮回调函数即可
3.控制视频的代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
public class videomanager : MonoBehaviour
{
// 这个脚本实现按钮控制VIDEO播放
GameObject oneVideoobj;
VideoPlayer myVideoComp;
bool isPlay=true;
private void Start()
{
oneVideoobj = GameObject.FindWithTag("Video");
myVideoComp = oneVideoobj.GetComponent<VideoPlayer>();
myVideoComp.Pause();
}
public void PLAYMYVIDEO()
{
Debug.Log("点击按钮成功");
if (isPlay)
{
Debug.Log("开始播放");
myVideoComp.Play();
isPlay &#