| | |
| | | using UnityEngine.Video; |
| | | using Spine.Unity; |
| | | using UnityEngine.UI; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | LoadAssetAsyncInternal<T>(directory, name, callBack, needExt); |
| | | } |
| | | |
| | | public async UniTask<T> LoadAssetAsync<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object |
| | | { |
| | | var tcs = new UniTaskCompletionSource<T>(); |
| | | LoadAssetAsync<T>(directory, name, (isLoaded, asset) => { |
| | | if (isLoaded) |
| | | { |
| | | tcs.TrySetResult(asset as T); |
| | | } |
| | | else |
| | | { |
| | | tcs.TrySetException(new Exception($"Failed to load asset: {directory}/{name}")); |
| | | } |
| | | }, needExt); |
| | | return await tcs.Task; |
| | | } |
| | | |
| | | private void LoadSpriteAsync<T>(string atlasName, string spriteName, Action<bool, UnityEngine.Object> callBack) where T : UnityEngine.Object |
| | | { |
| | | #if !UNITY_EDITOR |