Search Issue Tracker

Won't Fix

Votes

0

Found in

2021.3.25f1

2022.2.18f1

2023.1.0b16

2023.2.0a14

Issue ID

UUM-35112

Regression

No

[Undo] DestroyGameObjectHierarchyEventArgs.parentInstanceId is 0 when using undo on a created Child GameObject

--

-

Steps to reproduce:
1. Open the attached user's project "example_video.mov"
2. Open Assets/Scenes/SampleScene.unity
3. Right-click the "ParentObject" gameobject and select "Create Empty" to create a child gameobject
4. Press the "Enter" key to accept the child gameobject name
5. Right click the child gameobject and select "Delete"
6. Note the log message in the console: "DestroyGameObjectHierarchy: XXX with parent ParentObject in scene SampleScene."
7. Right-click the "ParentObject" gameobject again and select "Create Empty" to create a child gameobject
8. Press the "Enter" key to accept the child gameobject name
9. Go to the top menu and select "Edit/Undo Create GameObject"
10. Note the log message in the console: "DestroyGameObjectHierarchy: XXX with parent { null } in scene SampleScene."
11. The null parent gameobject in the second scenario seems to be caused by DestroyGameObjectHierarchyEventArgs.parentInstanceId being 0 in the callback

Expected results: DestroyGameObjectHierarchyEventArgs.parentInstanceId is not 0 when using undo on a created child gameobject
Actual Results: DestroyGameObjectHierarchyEventArgs.parentInstanceId is 0 when using undo on a created child gameobject

Reproducible in: 2021.3.25f1, 2022.2.18f1, 2023.1.0b16, 2023.2.0a14
Could not test on 2020.3.48f1 due to scripting errors when downgrading

Notes:
-A video is attached to show the reproduction steps "example_video.mov"

  1. Resolution Note:

    We have looked at this and we agree that the behavior is counter-intuitive. However, there is no expectation that UI interactions correspond one-to-one to events in the event stream. In the short term we are not going to address this issue, unfortunately.

    A closer look at the events in the stream shows that we do record a parent change event before the event for object destruction. This preceding event can be used to determine the parent of the destroyed object.

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.