mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-17 13:20:20 +00:00
Update samples
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using YooAsset;
|
||||
|
||||
public static class AssetOperationHandleExtension
|
||||
{
|
||||
/*
|
||||
/// <summary>
|
||||
/// 获取资源对象
|
||||
/// </summary>
|
||||
/// <typeparam name="TAsset"></typeparam>
|
||||
/// <param name="asset"></param>
|
||||
public static AssetOperationHandle GetAssetObject<TAsset>(this AssetOperationHandle thisHandle, out TAsset asset) where TAsset : UnityEngine.Object
|
||||
{
|
||||
if (thisHandle.Status != EOperationStatus.Succeed)
|
||||
{
|
||||
var assetInfo = thisHandle.GetAssetInfo();
|
||||
Debug.LogWarning($"The {assetInfo.AssetPath}[{assetInfo.AssetType}] is not success. Error[{thisHandle.LastError}]");
|
||||
}
|
||||
asset = thisHandle.AssetObject as TAsset;
|
||||
return thisHandle;
|
||||
}
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// 等待异步执行完毕
|
||||
/// </summary>
|
||||
public static AssetOperationHandle WaitForAsyncOperationComplete(this AssetOperationHandle thisHandle)
|
||||
{
|
||||
thisHandle.WaitForAsyncComplete();
|
||||
return thisHandle;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user