mirror of https://github.com/tuyoogame/YooAsset
Update AssetOperationHandle.cs
parent
bb3065d08d
commit
5425e17d6f
|
@ -49,31 +49,18 @@ namespace YooAsset
|
|||
return Provider.AssetObject;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取资源对象
|
||||
/// </summary>
|
||||
/// <typeparam name="TAsset"></typeparam>
|
||||
/// <param name="asset"></param>
|
||||
/// <returns></returns>
|
||||
public AssetOperationHandle GetAssetObjet<TAsset>(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;
|
||||
}
|
||||
/// <summary>
|
||||
/// 等待异步执行完毕
|
||||
/// </summary>
|
||||
public AssetOperationHandle WaitForAsyncOperationComplete()
|
||||
/// <typeparam name="TAsset">资源类型</typeparam>
|
||||
public TAsset GetAssetObjet<TAsset>() where TAsset : UnityEngine.Object
|
||||
{
|
||||
if (IsValid == false)
|
||||
return this;
|
||||
Provider.WaitForAsyncComplete();
|
||||
return this;
|
||||
return null;
|
||||
return Provider.AssetObject as TAsset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 等待异步执行完毕
|
||||
/// </summary>
|
||||
|
@ -133,6 +120,8 @@ namespace YooAsset
|
|||
{
|
||||
return InstantiateAsyncInternal(position, rotation, parent, true);
|
||||
}
|
||||
|
||||
|
||||
private GameObject InstantiateSyncInternal(Vector3 position, Quaternion rotation, Transform parent, bool setPositionRotation)
|
||||
{
|
||||
if (IsValid == false)
|
||||
|
|
Loading…
Reference in New Issue