I have a quad with a VideoPlayer on it and a script that controls playing the videos like below
VideoPlayer vp;
VideoClip [] vclips;
// Use this for initialization
void Start () {
vp = gameObject.GetComponent<VideoPlayer>();
vclips = Resources.LoadAll<VideoClip>("Movies");
vp.clip = vclips[Random.Range(0, vclips.Length)];
vp.Play();
}
// Update is called once per frame
void Update () {
if(!vp.isPlaying && vp.isPrepared)
{
vp.clip = vclips[Random.Range(0, vclips.Length)];
vp.Play();
}
}
When the new rand clip goes to play, the Unity stutters pretty hard. Is there some asynchronous way to load the clip so the game won’t stutter?