-
Notifications
You must be signed in to change notification settings - Fork 462
fix: Add OnPreShutdown to NetworkManager #3358
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -477,6 +477,12 @@ public struct ConnectionApprovalRequest | |
| /// </summary> | ||
| public event Action OnClientStarted = null; | ||
|
|
||
| /// <summary> | ||
| /// Subscribe to this static event to get notifications before a <see cref="NetworkManager"/> instance is being destroyed. | ||
| /// This is useful if you want to use the state of anything the NetworkManager cleans up during its shutdown. | ||
| /// </summary> | ||
| public event Action OnPreShutdown = null; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor side note, you don't need to set it to null as that is the default value when the NetworkManager class is instantiated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, I just figured I'd keep it consistent with the other events. |
||
|
|
||
| /// <summary> | ||
| /// This callback is invoked once the local server is stopped. | ||
| /// </summary> | ||
|
|
@@ -1198,6 +1204,8 @@ internal void ShutdownInternal() | |
| NetworkLog.LogInfo(nameof(ShutdownInternal)); | ||
| } | ||
|
|
||
| OnPreShutdown?.Invoke(); | ||
|
|
||
| this.UnregisterAllNetworkUpdates(); | ||
|
|
||
| // Everything is shutdown in the order of their dependencies | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.