Skip to main content
1 of 2
Mohit Saxena
  • 305
  • 1
  • 6
  • 17

Unity: How to make an array of video clips and play them?

i have 26 video files which i have to put in an array and play for different objects. so far i have written this from what i know:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;

public class videomanager : MonoBehaviour {

    public VideoClip[] vids;

    private VideoPlayer vp;

    // Use this for initialization
    void Start () {

        vids = new VideoClip[25];
        vp = gameObject.GetComponent<VideoPlayer> ();
    }
    
    // Update is called once per frame
    void Update () {
        
    }
}

i have attached this script on a plane i am playing the video on. before that i had 26 different planes each for different video but i think it would be better if i could play them on a single plane and change according to logic. i am not sure how should i load them into my player and play them.

Mohit Saxena
  • 305
  • 1
  • 6
  • 17