using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Video; public class VideoLoader { public static VideoClip Load(string name) { VideoClip mp4 = null; if (Application.isEditor) { #if UNITY_EDITOR var path = StringUtility.Contact(ResourcesPath.ResourcesOutAssetPath, "Video/", name, ".mp4"); mp4 = UnityEditor.AssetDatabase.LoadAssetAtPath(path); if (mp4 == null) { DebugEx.LogErrorFormat("VideoLoader.Load() => 加载不到资源: {0}.", name); } #endif } else { var assetInfo = new AssetInfo("video", name); mp4 = AssetBundleUtility.Instance.Sync_LoadAsset(assetInfo) as VideoClip; } return mp4; } }