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
670 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;
public class videoToUI : MonoBehaviour
{
public RawImage rawImage;
public VideoPlayer videoPlayer;
// Use this for initialization
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();
}
}