Fixed an issue with task asyn loading waiting

pull/4/head
hevinci 2022-04-21 21:39:00 +08:00
parent c836dce54d
commit 6675e8f171
2 changed files with 4 additions and 4 deletions

View File

@ -95,7 +95,7 @@ namespace YooAsset
/// <summary> /// <summary>
/// 异步操作任务 /// 异步操作任务
/// </summary> /// </summary>
public System.Threading.Tasks.Task<object> Task public System.Threading.Tasks.Task Task
{ {
get { return _provider.Task; } get { return _provider.Task; }
} }

View File

@ -199,7 +199,7 @@ namespace YooAsset
/// <summary> /// <summary>
/// 异步操作任务 /// 异步操作任务
/// </summary> /// </summary>
public Task<object> Task public Task Task
{ {
get get
{ {
@ -207,7 +207,7 @@ namespace YooAsset
{ {
_taskCompletionSource = new TaskCompletionSource<object>(); _taskCompletionSource = new TaskCompletionSource<object>();
if (IsDone) if (IsDone)
_taskCompletionSource.SetResult(this); _taskCompletionSource.SetResult(null);
} }
return _taskCompletionSource.Task; return _taskCompletionSource.Task;
} }
@ -228,7 +228,7 @@ namespace YooAsset
} }
if(_taskCompletionSource != null) if(_taskCompletionSource != null)
_taskCompletionSource.TrySetResult(this); _taskCompletionSource.TrySetResult(null);
} }
#endregion #endregion
} }