mirror of
https://github.com/Cysharp/UniTask.git
synced 2026-05-17 20:50:11 +00:00
complete implementation(triggers and etc...)
This commit is contained in:
@@ -40,7 +40,11 @@ namespace UniRx.Async
|
||||
public static void RegisterRaiseCancelOnDestroy(this CancellationTokenSource cts, GameObject gameObject)
|
||||
{
|
||||
var trigger = gameObject.GetAsyncDestroyTrigger();
|
||||
trigger.AddCancellationTriggerOnDestroy(cts);
|
||||
trigger.CancellationToken.RegisterWithoutCaptureExecutionContext(state =>
|
||||
{
|
||||
var cts2 = (CancellationTokenSource)state;
|
||||
cts2.Cancel();
|
||||
}, cts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user