Search Issue Tracker
By Design
Votes
4
Found in
2018.2.21f1
2018.3.11f1
Issue ID
1145961
Regression
No
Nested Prefabs hideflags are not applied when Prefab is saved
How to reproduce:
1. Open the attached 'PrefabDontSaveInEditorBug.zip' project
2. Go to the Project tab -> "Scenes" and open "SampleScene" scene
3. Go to the Hierarchy tab, select 'PrefabCreator' object and click on the 'Create' button in the Inspector tab
4. Expand 'ParentPrefab' and observe 'Prefab' object. Notice the "DontSaveInEditor" checkbox is marked
5. Go to Project tab -> "Prefabs" folder and double-click on "Prefab" asset
6. Modify prefab (ex. change transform position) and make sure 'Auto-Save' is on
7. Come back to the "SampleScene" scene "Prefab" instance and observe "DontSaveInEditor" checkbox
Expected result: Checkbox is marked
Actual result: Checkbox is unmarked
Reproducible: 2018.3.13f1, 2019.1.0f2, 2019.2.0a12, 2018.2.21f1 (a122f5dc316d)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- [VFX Graph] ArcCone Direction computation is wrong in Base Mode
- [Android] [Galaxy Tab] A singular Pen touch logs a Pen touch event and a singular finger touch event when logged using "VisualElement.RegisterCallback" with "Pointer(Up/Down)Event"
- Crash on D3D12DescriptorCache::Deallocate or vkGetInstanceProcAddr when loading RenderDoc in a specific Scene
- [HDRP] Lit material preview is rendered incorrectly with a mask map
- The "LerpWhiteTo" missing function displays an error when the Shadows.hlsl shader is included in a Shader file
Resolution Note:
This is by design.
Prefab instance objects do not own their hideflags. The hideflags are controlled by the underlying PrefabInstance object, so every time the prefab is merged the hideflags from the PrefabInstance object is propagated to the instantiated objects.
To achieve the result the user wants, the user should change from this:
GameObject obj = (GameObject)PrefabUtility.InstantiatePrefab(t.Prefab);
obj.transform.SetParent(t.Parent, false);
obj.hideFlags = HideFlags.DontSaveInEditor;
to:
GameObject obj = (GameObject)PrefabUtility.InstantiatePrefab(t.Prefab);
obj.transform.SetParent(t.Parent, false);
PrefabUtility.GetPrefabInstanceHandle(obj).hideFlags = HideFlags.DontSaveInEditor;