Add UniTask.Post

master
neuecc 2020-06-19 16:42:05 +09:00
parent d6a0563319
commit 5ed943bca2
2 changed files with 17 additions and 2 deletions

View File

@ -173,8 +173,15 @@ namespace Cysharp.Threading.Tasks.Internal
var action = actionList[i];
actionList[i] = null;
try
{
action();
}
catch (Exception ex)
{
UnityEngine.Debug.LogException(ex);
}
}
{
bool lockTaken = false;

View File

@ -44,6 +44,14 @@ namespace Cysharp.Threading.Tasks
return new ReturnToMainThread(timing);
}
/// <summary>
/// Queue the action to PlayerLoop.
/// </summary>
public static void Post(Action action, PlayerLoopTiming timing = PlayerLoopTiming.Update)
{
PlayerLoopHelper.AddContinuation(timing, action);
}
#endif
public static SwitchToThreadPoolAwaitable SwitchToThreadPool()