Commit bc23a35
fix: Nested NetworkBehaviours don't de-register or Invoke OnNetworkDespawn if destroyed while the parent NetworkObject remains spawned [NCCBUG-137] (#2091)
* fix
NCCBUG-137
This resolves the issue where destroying a GameObject with one or more NetworkBehaviour components that is a child or any child generation of the NetworkObject/GameObject that theNetworkBehaviour(s) are assigned to would still try to access the destroyed NetworkBehaviour since it was still an entry within the NetworkObject.ChildNetworkBehaviours list. It also resolves the issue where under this scenario the NetworkBehaviours would not have their OnNetworkDespawn method invoked.
* update
NCCBUG-137
updating the changelog
* fix
We need to check IsSpawned when logging a warning about a NetworkBehaviour not having an assigned NetworkObject (this is only valid if NetworkBehaviour.IsSpawned == true)
* fix
Needed to adjust to account for the condition when it is valid is when you have a NetworkBehaviour that is spawned but there is no assigned NetworkObject.
* test
NCCBUG-137
This is the integration validation test for this PR fix.
* update
Adding PR number to the changelog entry
* test
adding check for OnNetworkDespawn being invoked when a child NetworkBehaviour is destroyed. but the parent NetworkObject persists and remains spawned.
* style
MTT-4260
was created for this technical debt.
removing reminder to create a ticket.
* fix
fixing merge issue.
* fix
Removing the invocation of NetworkBehaviour's OnNetworkDespawn when a NetworkBehaviour is destroyed while a NetworkObject is still spawned.
* style
removing unused namespace.
* Update com.unity.netcode.gameobjects/CHANGELOG.md
Co-authored-by: Jesse Olmer <jesseo@unity3d.com>
Co-authored-by: Jesse Olmer <jesseo@unity3d.com>1 parent afce30f commit bc23a35
File tree
4 files changed
+77
-1
lines changed- com.unity.netcode.gameobjects
- Runtime/Core
- Tests/Runtime
4 files changed
+77
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
| 334 | + | |
| 335 | + | |
335 | 336 | | |
336 | 337 | | |
337 | 338 | | |
| |||
759 | 760 | | |
760 | 761 | | |
761 | 762 | | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
762 | 771 | | |
763 | 772 | | |
764 | 773 | | |
| |||
770 | 779 | | |
771 | 780 | | |
772 | 781 | | |
| 782 | + | |
773 | 783 | | |
774 | 784 | | |
775 | 785 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1219 | 1219 | | |
1220 | 1220 | | |
1221 | 1221 | | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
1222 | 1238 | | |
1223 | 1239 | | |
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
25 | 32 | | |
26 | 33 | | |
27 | 34 | | |
| |||
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
86 | 96 | | |
87 | 97 | | |
88 | 98 | | |
| |||
98 | 108 | | |
99 | 109 | | |
100 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
101 | 150 | | |
102 | 151 | | |
0 commit comments