mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
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:
parent
b66a5784f1
commit
163600c498
@ -84,8 +84,6 @@ public static int CompareNetworkIdentitySiblingPaths(NetworkIdentity left, Netwo
|
|||||||
[PostProcessScene]
|
[PostProcessScene]
|
||||||
public static void OnPostProcessScene()
|
public static void OnPostProcessScene()
|
||||||
{
|
{
|
||||||
var prefabWarnings = new HashSet<string>();
|
|
||||||
|
|
||||||
// vis2k: MISMATCHING SCENEID BUG FIX
|
// vis2k: MISMATCHING SCENEID BUG FIX
|
||||||
// problem:
|
// problem:
|
||||||
// * FindObjectsOfType order is not guaranteed. restarting the
|
// * FindObjectsOfType order is not guaranteed. restarting the
|
||||||
@ -158,12 +156,8 @@ public static void OnPostProcessScene()
|
|||||||
GameObject prefabRootGO = PrefabUtility.FindPrefabRoot(prefabGO);
|
GameObject prefabRootGO = PrefabUtility.FindPrefabRoot(prefabGO);
|
||||||
if (prefabRootGO)
|
if (prefabRootGO)
|
||||||
{
|
{
|
||||||
NetworkIdentity[] identities = prefabRootGO.GetComponentsInChildren<NetworkIdentity>();
|
if (prefabRootGO.GetComponentsInChildren<NetworkIdentity>().Length > 1)
|
||||||
if (identities.Length > 1 && !prefabWarnings.Contains(prefabRootGO.name))
|
|
||||||
{
|
{
|
||||||
// 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);
|
Debug.LogWarningFormat("Prefab '{0}' has several NetworkIdentity components attached to itself or its children, this is not supported.", prefabRootGO.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user