We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
public class TestA : MonoBehaviour { async UniTask OnEnable() { _cts = new CancellationTokenSource(); try { print("try [frameCount:" + Time.frameCount + "]" + "[isPlaying:" + Application.isPlaying + "]"); await UniTask.Delay(10000, cancellationToken: _cts.Token); } catch (Exception e) { print("catch [frameCount:" + Time.frameCount + "]" + "[isPlaying:" + Application.isPlaying + "]" + "\n" + e); } finally { print("finally [frameCount:" + Time.frameCount + "]" + "[isPlaying:" + Application.isPlaying + "]"); GameObject gameObject = new GameObject(); } } void OnDisable() { print("OnDisable, Cancel [frameCount:" + Time.frameCount + "]" + "[isPlaying:" + Application.isPlaying + "]"); _cts.Cancel(); } CancellationTokenSource _cts; }
When you quit immediately after playing with this code, a game object is created in the scene.
In my short opinion, Play Mode should not affect Edit Mode. but..
Is this behavior as intended?
The text was updated successfully, but these errors were encountered:
The additional slight rotation at the end mimics the UnitySynchronizationContext. https://github.com/Unity-Technologies/UnityCsReference/blob/master/Runtime/Export/Scripting/UnitySynchronizationContext.cs#L117 Whether the current UniTask behavior is really appropriate is debatable.
Sorry, something went wrong.
No branches or pull requests
When you quit immediately after playing with this code, a game object is created in the scene.
In my short opinion, Play Mode should not affect Edit Mode. but..
Is this behavior as intended?
The text was updated successfully, but these errors were encountered: