yyl
2026-02-25 9fb3c8e114a67c0cdf353b32b1b50e90414fd597
Main/ResModule/ResManager.cs
@@ -234,6 +234,27 @@
        LoadAssetAsyncInternal<T>(directory, name, callBack, needExt);
    }
    public async UniTask<T> LoadAssetAsync<T>(string directory, string name) where T : UnityEngine.Object
    {
        return await LoadAssetAsync<T>(directory, name, needExt: true);
    }
    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 (!AssetSource.isUseAssetBundle)