Skip to main content
Grammar + removing unityscript tag - code presented is in C#
Source Link
DMGregory
  • 136.3k
  • 22
  • 247
  • 373

iI have 26 video files which iI have to put in an array and play for different objects. soSo far iI have written this from what iI 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 () {
        
    }
}

iI have attached this script on a plane ion which I am playing the video on. before

Before that i, I had 26 different planes each, one for each different video, but iI think it would be better if iI could play them on a single plane and change the video according to logic. i

I am not sure how I should i load them into my player 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.

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 on which I am playing the video.

Before that, I had 26 different planes, one for each different video, but I think it would be better if I could play them on a single plane and change the video according to logic.

I am not sure how I should load them into my player and play them.

Source Link
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.