Single video player
using System.Collections;
using System.Collections.Generic;
using UnityEngine.SceneManagement;
using UnityEngine.Video;
using UnityEngine;
public class PlayVideo : MonoBehaviour
{
public GameObject videoPlayer;
void Start()
{
videoPlayer.SetActive(false);
}
void OnTriggerEnter(Collider player)
{
if (player.gameObject.tag == "Player01")
{
videoPlayer.SetActive(true);
}
}
}
Random video player within prefablist
using System.Collections;
using System.Collections.Generic;
using UnityEngine.SceneManagement;
using UnityEngine.Video;
using UnityEngine;
public class PlayVideo : MonoBehaviour
{
List<GameObject> prefabList = new List<GameObject>();
public GameObject videoPlayer01;
public GameObject videoPlayer02;
public GameObject videoPlayer03;
void Start()
{
videoPlayer01.SetActive(false);
videoPlayer02.SetActive(false);
videoPlayer03.SetActive(false);
}
void OnTriggerEnter(Collider player)
{
if (player.gameObject.tag == "Player01")
{
//videoPlayer01.SetActive(true);
int prefabIndex = UnityEngine.Random.Range(0, );
Instantiate(prefabList[prefabIndex]);
}
}
}
It’s trivial I guess but I can’t solve this true/false variable “videoPlayerXX.SetActive(true);”
Please help, Thank you!!!