using System.Collections; using System.IO; using UMP; using Unity.VisualScripting; using UnityEngine; using UnityEngine.UI; [RequireComponent(typeof(UniversalMediaPlayer))] public class UMPTool : MonoBehaviour { public string path; public Text Message; private UniversalMediaPlayer ump; void Start() { Init(); } void Init() { ump = GetComponent(); ump.Path = Application.streamingAssetsPath + path; ump.AddEncounteredErrorEvent(() => { Message.text = "当前链接失效!"; Message.color = Color.red; ump.RenderingObjects[0].GetComponent().texture = Texture2D.whiteTexture; ump.RenderingObjects[0].GetComponent().color = new Color(0, 0, 0, 0.5f); }); ump.AddPlayingEvent(() => { Message.text = ""; ump.RenderingObjects[0].GetComponent().color = Color.white; }); } }