Skip to content
New issue

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

Unity SDK: Delay dispose of CancellationTokenSource when quitting #4075

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kaboing
Copy link

@kaboing kaboing commented Dec 27, 2024

What type of PR is this?

Uncomment only one /kind <> line, press enter to put that in a new line, and remove leading whitespace from that line:

/kind breaking

/kind bug

/kind cleanup
/kind documentation
/kind feature
/kind hotfix
/kind release

What this PR does / Why we need it:
Quitting in Unity fires a number of events and callbacks.

MonoBehaviour.OnApplicationQuit is called before Application.wantsToQuit which leads to undesired behaviour. Application.wantsToQuit can be used to interrupt a quit process, so you can shut down gracefully. If this is utilized, the AgonesSDK has already disposed the cancellation token and future calls will fail.

We use this when controlling disruption https://agones.dev/site/docs/advanced/controlling-disruption/

Reference: https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Application-wantsToQuit.html

Same solution as in UniRX: neuecc/UniRx#463

Which issue(s) this PR fixes:

Closes #

Special notes for your reviewer:

Quitting in Unity fires a number of events and callbacks. 

`MonoBehaviour.OnApplicationQuit` is called before `Application.wantsToQuit`
which leads to undesired behaviour. `Application.wantsToQuit` can be used to interrupt a quit process, so you can shut down gracefully. If this is utilized, the AgonesSDK has already dispose the cancellation token and future calls will fail. 

Reference: https://docs.unity3d.com/6000.0/Documentation/ScriptReference/Application-wantsToQuit.html

Same solution as in UniRX: neuecc/UniRx#463
@github-actions github-actions bot added kind/bug These are bugs. size/XS labels Dec 27, 2024
@0xaravindh
Copy link
Member

/gcbrun

@agones-bot
Copy link
Collaborator

Build Succeeded 🥳

Build Id: 80def32a-2120-4a72-9f4d-2e45d0648ef0

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

git fetch https://github.com/googleforgames/agones.git pull/4075/head:pr_4075 && git checkout pr_4075
helm install agones ./install/helm/agones --namespace agones-system --set agones.image.registry=us-docker.pkg.dev/agones-images/ci --set agones.image.tag=1.46.0-dev-9d92406

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug These are bugs. size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants