private void Refresh() { delayTimeField.text = sourceManager.delayTime.ToString(); foreach (Transform item in verticalListContainer) { Destroy(item.gameObject); } Dictionary <string, VideoSourceModel> sources = sourceManager.GetAllVideoModels(); foreach (VideoSourceModel model in sources.Values) { GameObject go = Instantiate(videoItemPrefab); go.transform.SetParent(verticalListContainer, false); go.GetComponent <VideoItemUI>().Init(model, this); } audioUrl.text = sourceManager.GetAudioURL(); string fileName = Application.persistentDataPath + "/Documents/audio.mp3"; if (File.Exists(fileName)) { audioStatusText.text = "on disk"; } }
public void Refresh() { foreach (VideoPlayerController video in videos) { Destroy(video.gameObject); } videos.Clear(); Dictionary <string, VideoSourceModel> sources = sourceManager.GetAllVideoModels(); foreach (VideoSourceModel item in sources.Values) { GameObject go = Instantiate(videoPlayerPrefab); VideoPlayerController videoController = go.GetComponent <VideoPlayerController>(); videoController.transform.SetParent(transform, false); videoController.Init(item, sourceManager); if (sourceManager.useFake) { videoController.SetClip(fakeSource); } videos.Add(videoController); } if (videos.Count > 0) { videos[0].gameObject.SetActive(true); videos[0].EnableContent(true); } }