diff --git a/Assets/Mirror/Core/NetworkServer.cs b/Assets/Mirror/Core/NetworkServer.cs index 18462317e..d85d7ce75 100644 --- a/Assets/Mirror/Core/NetworkServer.cs +++ b/Assets/Mirror/Core/NetworkServer.cs @@ -1230,7 +1230,15 @@ public static bool SpawnObjects() if (!active) return false; - NetworkIdentity[] identities = Resources.FindObjectsOfTypeAll(); + // find all NetworkIdentities in the scene. + // all of them are disabled because of NetworkScenePostProcess. + // however, ignore identities under disabled parent objects. + // users would put them under disabled parents to 'deactivate' them. + // those should not be used by Mirror at all. + // fixes: https://github.com/MirrorNetworking/Mirror/issues/3330 + IEnumerable identities = Resources.FindObjectsOfTypeAll() + .Where(identity => identity.transform.parent == null || + identity.transform.parent.gameObject.activeInHierarchy); // first pass: activate all scene objects foreach (NetworkIdentity identity in identities)