Skip to content

Commit e43d65e

Browse files
fix
This resolves the issue where a disabled NetworkBehaviour was being included in the ChildNetworkBehaviours list which would cause an exception upon a client attempting to synchronize.
1 parent 1d04a27 commit e43d65e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

com.unity.netcode.gameobjects/Runtime/Core/NetworkObject.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2639,6 +2639,11 @@ internal List<NetworkBehaviour> ChildNetworkBehaviours
26392639
{
26402640
continue;
26412641
}
2642+
else if (!networkBehaviours[i].isActiveAndEnabled)
2643+
{
2644+
Debug.LogWarning($"[{name}][{networkBehaviours[i].GetType().Name}][{nameof(isActiveAndEnabled)}: {networkBehaviours[i].isActiveAndEnabled}] Disabled {nameof(NetworkBehaviour)}s are not supported and will be excluded from spawning and synchronization!");
2645+
continue;
2646+
}
26422647

26432648
// Set ourselves as the NetworkObject that this behaviour belongs to and add it to the child list
26442649
var nextIndex = (ushort)m_ChildNetworkBehaviours.Count;

0 commit comments

Comments
 (0)