Search Issue Tracker
Fixed
Fixed in 2022.3.5f1, 2023.1.2f1, 2023.2.0a20
Votes
0
Found in
2020.3.45f1
2021.3.18f1
2022.2.8f1
2023.1.0b5
2023.2.0a4
Issue ID
UUM-28068
Regression
No
A second unparented GameObject is created when duplicating a Prefab with a child that has HideFlags.DontSave
Reproduction steps:
1. Open the attached project “BugDuplicatedObjectWithHideFlags”
2. Select “ObjectWithAutoCreatorAsPrefabInstance” in the Hierarchy window
3. Duplicate the selected GameObject
Expected result: there is only one “~SubObjectHidden” child GameObject
Actual result: there are two “~SubObjectHidden” GameObjects and the second one is unparented and not affected by the SubObjectHideInInspector Script on the parent
Reproducible with: 2022.2.8f1, 2023.1.0b5, 2023.2.0a4
Not reproducible with: 2020.3.45f1, 2021.3.18f1
Reproducible on: macOS 12.4 (Intel), Windows 11 (user’s)
Note: in 2020.3.45f1 and 2021.3.18f1, the child is not unparented
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
- TextMeshPro text input's caret is flickering when Line Mode is set to Multi Line and text is selected
- Can’t delete gradient keys with Mac keyboard or context menu options
- Editor freezes for a few minutes when closing or switching a VFX window that was opened in a previous project
- UI Overlaps when switching Render Pipeline Asset for different Quality Levels in Quality Project Settings
- Ray Tracing Shader link to the documentation isn’t working
Resolution Note (fix version 2023.2.0a20):
Please make sure to call PrefabUtility.RecordPrefabInstancePropertyModifications(this) in SubObjectHideInHierarchy.cs after adding the child object and setting the hideflag. This ensures that the changes to the instance are registered, and results in correct behaviour when duplicating.
Resolution Note (fix version 2023.1.2f1):
Please make sure to call PrefabUtility.RecordPrefabInstancePropertyModifications(this) in SubObjectHideInHierarchy.cs after adding the child object and setting the hideflag. This ensures that the changes to the instance are registered, and results in correct behaviour when duplicating.