Commit dfef393
fix: [NGOv2.x] Add OnPreShutdown to NetworkManager (#3366)
Forwardport of
#3358
This PR adds a `NetworkManager.OnPreShutdown` callback that happens
before the internal shutdown is done. This is to allow accessing any
state that is cleaned up by the `NetworkManager` during shutdown, such
as accessing dynamically spawned NetworkObjects.
## Changelog
- Added: The event NetworkManager.OnPreShutdown has been added which is
called before the NetworkManager cleans up and shuts down.
## Testing and Documentation
- A test has been added to ensure this is being called, and called
before OnServerStopped.
<!-- Uncomment and mark items off with a * if this PR deprecates any
API:
### Deprecated API
- [ ] An `[Obsolete]` attribute was added along with a `(RemovedAfter
yyyy-mm-dd)` entry.
- [ ] An [api updater] was added.
- [ ] Deprecation of the API is explained in the CHANGELOG.
- [ ] The users can understand why this API was removed and what they
should use instead.
-->
---------
Co-authored-by: Noel Stephens <[email protected]>1 parent 120cdcc commit dfef393
File tree
3 files changed
+49
-0
lines changed- com.unity.netcode.gameobjects
- Runtime/Core
- Tests/Runtime
3 files changed
+49
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
807 | 807 | | |
808 | 808 | | |
809 | 809 | | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
810 | 816 | | |
811 | 817 | | |
812 | 818 | | |
| |||
1481 | 1487 | | |
1482 | 1488 | | |
1483 | 1489 | | |
| 1490 | + | |
| 1491 | + | |
1484 | 1492 | | |
1485 | 1493 | | |
1486 | 1494 | | |
| |||
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
239 | 279 | | |
240 | 280 | | |
241 | 281 | | |
| |||
0 commit comments