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

Teardown when Play Mode is stopped while the Autopilot running #109

Merged
merged 3 commits into from
Nov 20, 2024

Conversation

nowsprinting
Copy link
Contributor

@nowsprinting nowsprinting commented Nov 18, 2024

Problem

The AutopilotState asset still contained information that the autopilot was running, so it had to be reset.

Condition: When a user stops Play Mode while the Autopilot is running.

Fixes

Reset the AutopilotState when Play Mode is stopped while the Autopilot is running,
using EditorApplication.playModeStateChanged event.

This behavior was tested enable and disable domain reloading in Enter Play Mode Settings.

Minor fixes: Improved the exit process when launching from the commandline.

Priority

I hope to your review && merge around one week.
There is no need to release it yet.


Contribution License Agreement

@nowsprinting nowsprinting requested a review from a team as a code owner November 18, 2024 08:33
@github-actions github-actions bot added the fix label Nov 18, 2024
@bo40
Copy link
Contributor

bo40 commented Nov 19, 2024

@nowsprinting
I tested this PR on my local machine using Unity Editor 2021.3.
When I start Anjin by the Run button inside Inspector window and then manually switch from Play Mode to Editor Mode, OnChangePlayModeState is not called, and the autopilot state is not reset.
Do you have any idea what might be causing this issue?

@nowsprinting
Copy link
Contributor Author

@bo40 san, Sorry, maybe it does not work if domain reloading is enabled.
Could you please disable it and try again?
In Edit > Editor > Enter Play Mode Settings

I will add a warning to README.

@nowsprinting nowsprinting marked this pull request as draft November 19, 2024 07:30
@bo40
Copy link
Contributor

bo40 commented Nov 19, 2024

@nowsprinting
After disabling the domain reloading setting, Anjin worked as expected. Thank you for your prompt reply!

@nowsprinting
Copy link
Contributor Author

@bo40 san, I FIxed it.

  • Same behavior if enabling domain reloading
  • Improved the exit process when launching from the commandline.
  • Left the troubleshooting section in the READMEs. Also added case the Run button on AutopilotSettings.

@nowsprinting nowsprinting marked this pull request as ready for review November 19, 2024 14:42
Copy link
Contributor

@bo40 bo40 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!
LGTM 👍

@bo40 bo40 merged commit d634b33 into DeNA:master Nov 20, 2024
2 of 3 checks passed
@nowsprinting nowsprinting deleted the fix/stop_playmode branch November 20, 2024 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants