NetworkScenePostProcess: removed prefabWarnings HashSet because the extra code is not worth the rare case where we have more than one NetworkIdentity on a prefab. There is no harm in showing a warning for each one.

This commit is contained in:
vis2k 2018-12-30 15:29:45 +01:00
parent b66a5784f1
commit 163600c498

View File

@ -84,8 +84,6 @@ public static int CompareNetworkIdentitySiblingPaths(NetworkIdentity left, Netwo
[PostProcessScene]
public static void OnPostProcessScene()
{
var prefabWarnings = new HashSet<string>();
// vis2k: MISMATCHING SCENEID BUG FIX
// problem:
// * FindObjectsOfType order is not guaranteed. restarting the
@ -158,12 +156,8 @@ public static void OnPostProcessScene()
GameObject prefabRootGO = PrefabUtility.FindPrefabRoot(prefabGO);
if (prefabRootGO)
{
NetworkIdentity[] identities = prefabRootGO.GetComponentsInChildren<NetworkIdentity>();
if (identities.Length > 1 && !prefabWarnings.Contains(prefabRootGO.name))
if (prefabRootGO.GetComponentsInChildren<NetworkIdentity>().Length > 1)
{
// make sure we only print one error per prefab
prefabWarnings.Add(prefabRootGO.name);
Debug.LogWarningFormat("Prefab '{0}' has several NetworkIdentity components attached to itself or its children, this is not supported.", prefabRootGO.name);
}
}