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