You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
603 B

using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;
public class videoToUI : MonoBehaviour
{
public RawImage rawImage;
public VideoPlayer videoPlayer;
void Start()
{
StartCoroutine(PlayVideo());
}
IEnumerator PlayVideo()
{
videoPlayer.Prepare();
WaitForSeconds waitForSeconds = new WaitForSeconds(1);
while (!videoPlayer.isPrepared)
{
yield return waitForSeconds;
break;
}
rawImage.texture = videoPlayer.texture;
videoPlayer.Play();
}
}