mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
parent
69d89d8845
commit
5d066f3cd1
@ -1230,7 +1230,15 @@ public static bool SpawnObjects()
|
|||||||
if (!active)
|
if (!active)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
NetworkIdentity[] identities = Resources.FindObjectsOfTypeAll<NetworkIdentity>();
|
// 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<NetworkIdentity> identities = Resources.FindObjectsOfTypeAll<NetworkIdentity>()
|
||||||
|
.Where(identity => identity.transform.parent == null ||
|
||||||
|
identity.transform.parent.gameObject.activeInHierarchy);
|
||||||
|
|
||||||
// first pass: activate all scene objects
|
// first pass: activate all scene objects
|
||||||
foreach (NetworkIdentity identity in identities)
|
foreach (NetworkIdentity identity in identities)
|
||||||
|
Loading…
Reference in New Issue
Block a user