NetworkServer.SpawnObjects: use foreach in first loop

This commit is contained in:
vis2k 2018-12-30 22:51:47 +01:00
parent df7c66e4c7
commit 1418fb66b7

View File

@ -1189,16 +1189,16 @@ public static bool SpawnObjects()
return true;
NetworkIdentity[] identities = Resources.FindObjectsOfTypeAll<NetworkIdentity>();
for (int i = 0; i < identities.Length; i++)
foreach (NetworkIdentity identity in identities)
{
NetworkIdentity identity = identities[i];
if (!ValidateSceneObject(identity))
continue;
if (LogFilter.Debug) { Debug.Log("SpawnObjects sceneId:" + identity.sceneId + " name:" + identity.gameObject.name); }
identity.Reset();
identity.gameObject.SetActive(true);
if (ValidateSceneObject(identity))
{
if (LogFilter.Debug) { Debug.Log("SpawnObjects sceneId:" + identity.sceneId + " name:" + identity.gameObject.name); }
identity.Reset();
identity.gameObject.SetActive(true);
}
}
for (int i = 0; i < identities.Length; i++)
{
NetworkIdentity identity = identities[i];