This commit is contained in:
vis2k 2021-02-18 13:56:26 +08:00
parent d8187d4b7d
commit 4624f34b0e

View File

@ -89,14 +89,14 @@ static void PrepareSceneObject(NetworkIdentity identity)
#if UNITY_2018_2_OR_NEWER #if UNITY_2018_2_OR_NEWER
GameObject prefabGO = PrefabUtility.GetCorrespondingObjectFromSource(identity.gameObject); GameObject prefabGO = PrefabUtility.GetCorrespondingObjectFromSource(identity.gameObject);
#else #else
GameObject prefabGO = PrefabUtility.GetPrefabParent(identity.gameObject); GameObject prefabGO = PrefabUtility.GetPrefabParent(identity.gameObject);
#endif #endif
if (prefabGO) if (prefabGO)
{ {
#if UNITY_2018_3_OR_NEWER #if UNITY_2018_3_OR_NEWER
GameObject prefabRootGO = prefabGO.transform.root.gameObject; GameObject prefabRootGO = prefabGO.transform.root.gameObject;
#else #else
GameObject prefabRootGO = PrefabUtility.FindPrefabRoot(prefabGO); GameObject prefabRootGO = PrefabUtility.FindPrefabRoot(prefabGO);
#endif #endif
if (prefabRootGO != null && prefabRootGO.GetComponentsInChildren<NetworkIdentity>().Length > 1) if (prefabRootGO != null && prefabRootGO.GetComponentsInChildren<NetworkIdentity>().Length > 1)
{ {