From 2ca2c488acc3966ef7dc67cb530c5db9eaa8b0ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Faludi?= Date: Wed, 31 Jul 2019 10:28:34 +0200 Subject: [PATCH] fix: SceneId was not set to 0 for prefab variants (#976) (#977) * fix: SceneId was not set to 0 for prefab variants (#976) * Update NetworkIdentity.cs --- Assets/Mirror/Runtime/NetworkIdentity.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Assets/Mirror/Runtime/NetworkIdentity.cs b/Assets/Mirror/Runtime/NetworkIdentity.cs index b6b6edf584a..d1c717ce353 100644 --- a/Assets/Mirror/Runtime/NetworkIdentity.cs +++ b/Assets/Mirror/Runtime/NetworkIdentity.cs @@ -361,17 +361,19 @@ void SetupIDs() m_SceneId = 0; // force 0 for prefabs AssignAssetID(gameObject); } - else if (ThisIsASceneObjectWithPrefabParent(out GameObject prefab)) - { - AssignSceneID(); - AssignAssetID(prefab); - } + // check prefabstage BEFORE SceneObjectWithPrefabParent + // (fixes https://github.com/vis2k/Mirror/issues/976) else if (PrefabStageUtility.GetCurrentPrefabStage() != null) { m_SceneId = 0; // force 0 for prefabs string path = PrefabStageUtility.GetCurrentPrefabStage().prefabAssetPath; AssignAssetID(path); } + else if (ThisIsASceneObjectWithPrefabParent(out GameObject prefab)) + { + AssignSceneID(); + AssignAssetID(prefab); + } else { AssignSceneID();