Search Issue Tracker
Fixed in 2021.2.X
Votes
0
Found in
2018.4
2020.1.1f1
2020.2
Issue ID
1279490
Regression
No
GetSiblingIndex() inside onDestroy() returns number of sibling GameObejcts - 1 when a GameObject is deleted through Hierarchy
How to reproduce:
1. Open the attached "Sibling" project
2. Open the "SampelScene" Scene
3. In the Hierarchy select the "0" GameObject which is a child of the "GameObject" GameObject
4. Delete the selected GameObject
Expected results: In the Console, the "Sibling Index During Destroy: 0" message is printed
Actual results: In the Console, the "Sibling Index During Destroy: 3" message is printed
Reproducible with: 2018.4.27f1, 2019.4.11f1, 2020.1.6f1, 2020.2.0b4
Notes:
- When deleting the child GameObject from Hierarchy it will print out the number of a sibling GameObjects - 1 as an index instead of where that GameObject sits in the sibling Hierarchy.
- When the OnDestroy() function is called not when deleting a GameObject through the Hierarchy, the GetSiblingIndex() will return the correct value
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
- “FocusController has unprocessed focus events.” warnings are thrown after adding iOS, tvOS or visionOS Build Profiles
- Holes and different colors appear on default Tree Materials after applying them to the Tree GameObject and undoing changes
- Error indicating that the Text Asset Importer hasn't been disposed properly is logged when switching Importer Type in a Focused Inspector
- Documentation installation shows "Install failed: Validation Failed" when installing Android Build Support module
- Error indicating that the Package Manifest Importer hasn't been disposed properly is logged when switching Importer Type in a Focused Inspector
Resolution Note (fix version 2021.2):
Fixed in Unity 2021.2.0a9