Search Issue Tracker

Fixed in 2021.2.X

Votes

5

Found in

2018.4

2019.2.0a13

2019.4

2020.3

2021.1

2021.2.0a7

Issue ID

1158741

Regression

No

OnTransformParentChanged is called twice when deleting the gameobject in the hierarchy while in play mode

Scene Management

-

How to reproduce:
1. Open the attached project ("OnTransformParentChanged.zip")
2. Open the repro scene ("SampleScene")
3. Enter the play mode
4. Delete the children object from the Hierarchy
5. Inspect the console

Expected results: OnTransformParentChanged is called once
Actual results: OnTransformParentChanged is called twice

Reproducible with: 2018.4.33f1, 2019.4.24f1, 2020.3.3f1, 2021.1.2f1, 2021.2.0a7
Not reproducible with: 2021.2.0a9, 2021.2.0a11
Could not test with: 2021.2.0a8 (Backend Errors)

Notes:
1. During the first "OnTransformParentChanged" call, the parent is set to null, and during the second call it is set to the old parent value again
2. Destroying the object with "Destroy" method does not result in any "OnTransformParentChanged" calls

  1. Resolution Note (fix version 2021.2):

    Fixed in 2021.2.0a9

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.