Skip to content

Commit

Permalink
fix: SceneId was not set to 0 for prefab variants (#976) (#977)
Browse files Browse the repository at this point in the history
* fix: SceneId was not set to 0 for prefab variants (#976)

* Update NetworkIdentity.cs
  • Loading branch information
DrummerB authored and miwarnec committed Jul 31, 2019
1 parent 246a551 commit 2ca2c48
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Assets/Mirror/Runtime/NetworkIdentity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 2ca2c48

Please sign in to comment.