Skip to content

fix: networkmanager cannot be started within OnClientStopped or OnServerStopped callbacks#3908

Merged
NoelStephensUnity merged 7 commits intodevelop-2.0.0from
fix/networkmanager-start-from-onstopped
Mar 20, 2026
Merged

fix: networkmanager cannot be started within OnClientStopped or OnServerStopped callbacks#3908
NoelStephensUnity merged 7 commits intodevelop-2.0.0from
fix/networkmanager-start-from-onstopped

Conversation

@NoelStephensUnity
Copy link
Member

@NoelStephensUnity NoelStephensUnity commented Mar 19, 2026

Purpose of this PR

Based on a user submitted issue, adding the ability to start NetworkManager from within NetworkManager.OnClientStopped or NetworkManager.OnServerStopped.

If a host starts itself within the NetworkManager.OnClientStopped, then it will skip invoking the NetworkManager.OnServerStopped since it will have already been started again.

fixes: #2703

Jira ticket

MTT-10150

Changelog

  • Fixed: If a user starts NetworkManager from within one of its stopped callbacks at the end of shutdown it will fail to start properly.

Documentation

  • Includes edits to existing public API documentation.

Testing & QA (How your changes can be verified during release Playtest)

Functional Testing

Manual testing :

  • Manual testing done

Automated tests:

  • Covered by existing automated tests
  • Covered by new automated tests

Does the change require QA team to:

  • Review automated tests?
  • Execute manual tests?
  • Provide feedback about the PR?

If any boxes above are checked the QA team will be automatically added as a PR reviewer.

Backports

No backport. This will be v2.x specific.

Fixing the issue where users might try to start NetworkManager within OnClientStopped or OnServerStopped which would result in a failed start.
Adding test that verifies a NetworkManager can be started when OnClientStopped is invoked and that OnServerStopped is not invoked if the NetworkManager is started again during an OnClientStopped invocation (i.e. host).
@NoelStephensUnity NoelStephensUnity requested a review from a team as a code owner March 19, 2026 00:16
Removing model: rtx2080 from our yamato vm definition file.
@NoelStephensUnity NoelStephensUnity requested review from a team and EmandM as code owners March 19, 2026 15:51
Copy link
Member

@EmandM EmandM left a comment

Choose a reason for hiding this comment

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

This is huge!

Adding additional information about some events we have added but do not cover in NetworkManager.
Added additional information about starting NetworkManager within OnClientStopped or OnServerStopped.
Adding changelog entry.
Copy link
Contributor

@jabbacakes jabbacakes left a comment

Choose a reason for hiding this comment

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

Mostly just wording tweaks. Main change is moving the info about pre-shutdown notifications to the bottom of its section. It makes more sense to me to introduce the 'you will definitely want to do this' info first, and then add the if statement of 'and you can also do this if you need something else'.

Co-authored-by: Amy Reeve <amy.reeve@unity3d.com>
@NoelStephensUnity NoelStephensUnity enabled auto-merge (squash) March 20, 2026 14:44
@NoelStephensUnity NoelStephensUnity merged commit 1495955 into develop-2.0.0 Mar 20, 2026
23 of 24 checks passed
@NoelStephensUnity NoelStephensUnity deleted the fix/networkmanager-start-from-onstopped branch March 20, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calling StartClient() from within an OnServerStopped() callback leads to inconsistent state

4 participants