sort hierarchy under same parent using code
hello, If i have few UI objects under same parent, the lowest one in the hierarchy of that parent is the highest one to be displayed on top of all others.
is there a way in code to sort a GameObject to be the lowest (top of display) one ?
I already have them all in array and controller that is aware of them.
Thank you.
Answer by ScaniX · Jan 26, 2017 at 02:30 PM
See here: https://docs.unity3d.com/ScriptReference/Transform.html
You can use the following methods to set your index among your siblings:
SetSiblingIndex()
SetAsFirstSibling()
SetAsLastSibling()
Your answer
![](https://koobas.hobune.stream/wayback/20220612105642im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Is prefab hierarchy limited to just one level? 1 Answer
How can I organize menus as a tree hierarchy? 0 Answers
Trigger Canvas UI with Collider? C# Help! 1 Answer
Free Proffesional UI look 0 Answers