51 lines
970 B
C#
Raw Normal View History

2025-03-11 16:24:25 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
public class VideoController : MonoBehaviour
{
public VideoPlayer videoPlayer;
public bool ifPlay=false;
private bool ifPlaying = false;
/*
*
*
*/
private void Awake()
{
videoPlayer.url = Application.streamingAssetsPath + "/video_HNT.mp4";
}
// Start is called before the first frame update
void Start()
{
ifPlay = false;
ifPlaying = false;
}
// Update is called once per frame
void Update()
{
if (ifPlay&&!ifPlaying)
{
videoPlayer.Stop();
videoPlayer.Play();
ifPlaying = true;
}
if (ifPlaying&&!ifPlay)
{
videoPlayer.Stop();
videoPlayer.Play();
ifPlaying = false;
}
}
}