UniTask
UniTask copied to clipboard
Cancelling all running Unitask operations
Hi,
Is there a way to kill all running UniTask operations without attaching a cancellation token to each of them? We have a state where we need to "soft restart" the game which requires suspension of everything UniTask related.
We have tried modifying the PlayerLoopHelper by adding the following and it works but we're currently looking for a way to deal with this without modifying the code;
public static void StopAll() {
IsEditorApplicationQuitting = true;
if (runners != null) {
for (var i = 0; i < runners.Length; i++) {
runners[i].Clear();
}
}
if (yielders != null) {
for (var i = 0; i < yielders.Length; i++) {
yielders[i].Clear();
}
}
IsEditorApplicationQuitting = false;
}
Thanks in advance.