UI draw order in scene

How can I control the drawing order of my objects in the UI? I know that the order is given by the position of the node in the scene hierarchy.
I can also create separate cameras and set their rendering priority. But a large number of cameras degrades performance
Are there other ways to control the drawing order of objects in the UI?


If they are under the same parent, we can use setSiblingIndex to arrange their drawing orders.

The highest number will be drawn last (so, it will be on the top of everything else under the same parent).

Yes, I mentioned that approach in OP. Problem is I can’t change node’s position in hierarchy because of multiple reasons.

This can be used to adjust rendering order (z-order in 2D games) at runtime (regardless of the hierarchy in the Editor).
If you cannot provide your problems in details, we can’t help much.

setSiblingIndex is the only way to change UI rendering order in runtime. If you must keep order of nodes as you put before run game, you can store their order in onLoad() functions and use it for your purposes.