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

  1. 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.

  2. 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.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.