mirror of https://github.com/tuyoogame/YooAsset
Merge pull request #17 from Y-way/OptimizeAssetOperationHandle
AssetOperationHandle类新增便捷方法,便于链式编程pull/18/head
commit
bb3065d08d
|
@ -49,7 +49,31 @@ namespace YooAsset
|
||||||
return Provider.AssetObject;
|
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()
|
||||||
|
{
|
||||||
|
if (IsValid == false)
|
||||||
|
return this;
|
||||||
|
Provider.WaitForAsyncComplete();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 等待异步执行完毕
|
/// 等待异步执行完毕
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -109,8 +133,6 @@ 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