using System.Collections; using System.Collections.Generic; using UnityEngine; using System.Collections.Generic; using UnityEngine.Video; using System.Collections; public partial class VideoManager : MonoBehaviour { public VideoObject videoPrefab; public Vector2Int testAmount; public List urlList; public List videoObjects = new(); [ContextMenu("VideoTest")] public void TestPlayVideo() { for (int i = 0; i < testAmount.x; i++) { for (int j = 0; j < testAmount.y; j++) { // var tempPrefab = videoPrefab.Instantiate() // .Position(new Vector3(i * 2, j * 2, 0)) // .Show(); // videoObjects.Add(tempPrefab); } } StartCoroutine(LoadAllVideo()); } IEnumerator LoadAllVideo() { // foreach (var video in videoObjects) // { // video.SetVideoUrl(GetRandomUrl()); // while (!video.VideoPlayer.isPrepared) // { // yield return null; // } //} yield return null; } string GetRandomUrl() { return urlList[Random.Range(0, urlList.Count - 1)]; } }