diff --git a/Assets/YooAsset/Runtime/AssetSystem/Handles/AssetOperationHandle.cs b/Assets/YooAsset/Runtime/AssetSystem/Handles/AssetOperationHandle.cs index 7083e3c..add1558 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Handles/AssetOperationHandle.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Handles/AssetOperationHandle.cs @@ -49,21 +49,45 @@ namespace YooAsset return Provider.AssetObject; } } - + /// + /// 获取资源对象 + /// + /// + /// + /// + public AssetOperationHandle GetAssetObjet(out TAsset asset) where TAsset : UnityEngine.Object + { + if(Status != EOperationStatus.Succeed) + { + YooLogger.Warning($"The {Provider.MainAssetInfo.AssetPath}[{Provider.MainAssetInfo.AssetType}] is not success.Error[{Provider.LastError}]"); + } + asset = AssetObject as TAsset; + return this; + } /// /// 等待异步执行完毕 /// - public void WaitForAsyncComplete() + public AssetOperationHandle WaitForAsyncOperationComplete() { if (IsValid == false) - return; + return this; Provider.WaitForAsyncComplete(); + return this; } + /// + /// 等待异步执行完毕 + /// + public void WaitForAsyncComplete() + { + if(IsValid == false) + return; + Provider.WaitForAsyncComplete(); + } - /// - /// 释放资源句柄 - /// - public void Release() + /// + /// 释放资源句柄 + /// + public void Release() { this.ReleaseInternal(); } @@ -109,8 +133,6 @@ namespace YooAsset { return InstantiateAsyncInternal(position, rotation, parent, true); } - - private GameObject InstantiateSyncInternal(Vector3 position, Quaternion rotation, Transform parent, bool setPositionRotation) { if (IsValid == false) @@ -142,4 +164,4 @@ namespace YooAsset return operation; } } -} \ No newline at end of file +}