mirror of https://github.com/Cysharp/UniTask
Merge pull request #493 from Cysharp/hadashiA/monitor
Reduce the times of AwakeMonitor checkingpull/499/head
commit
06346b8a2a
|
@ -32,13 +32,11 @@ namespace Cysharp.Threading.Tasks.Triggers
|
||||||
if (cancellationTokenSource == null)
|
if (cancellationTokenSource == null)
|
||||||
{
|
{
|
||||||
cancellationTokenSource = new CancellationTokenSource();
|
cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
if (!awakeCalled)
|
||||||
|
{
|
||||||
|
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, new AwakeMonitor(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!awakeCalled)
|
|
||||||
{
|
|
||||||
PlayerLoopHelper.AddAction(PlayerLoopTiming.Update, new AwakeMonitor(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
return cancellationTokenSource.Token;
|
return cancellationTokenSource.Token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +81,7 @@ namespace Cysharp.Threading.Tasks.Triggers
|
||||||
|
|
||||||
public bool MoveNext()
|
public bool MoveNext()
|
||||||
{
|
{
|
||||||
if (trigger.called) return false;
|
if (trigger.called || trigger.awakeCalled) return false;
|
||||||
if (trigger == null)
|
if (trigger == null)
|
||||||
{
|
{
|
||||||
trigger.OnDestroy();
|
trigger.OnDestroy();
|
||||||
|
|
Loading…
Reference in New Issue