File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Assets/BossRoom/Scripts/Shared/Game/Entity Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 3
3
4
4
namespace Unity . Multiplayer . Samples . BossRoom
5
5
{
6
+ /// <summary>
7
+ /// This class temporarily allows NetworkObjects to be parented to children of NetworkObjects, since Netcode for
8
+ /// GameObjects currently expects NetworkObjects to be parented to other NetworkObjects.
9
+ /// <remarks>
10
+ /// To enable a NetworkObject to be parented to this NetworkBehaviour, make sure its "Auto Object Parent Sync"
11
+ /// field is toggled off.
12
+ /// </remarks>
13
+ /// </summary>
6
14
public class CustomParentingHandler : NetworkBehaviour
7
15
{
8
16
public bool preserveWorldSpace = true ;
@@ -20,6 +28,11 @@ public override void OnNetworkSpawn()
20
28
base . OnNetworkSpawn ( ) ;
21
29
}
22
30
31
+ public override void OnNetworkDespawn ( )
32
+ {
33
+ m_NetworkObjectChildren . OnListChanged -= NetworkObjectChildrenOnListChanged ;
34
+ }
35
+
23
36
void NetworkObjectChildrenOnListChanged ( NetworkListEvent < ulong > changeEvent )
24
37
{
25
38
switch ( changeEvent . Type )
You can’t perform that action at this time.
0 commit comments