Render order UI change by code

Hi,

How can i force something to be rendered in front of the rest by code?
I have a couple of cards on screen and when selecting one of them, they grow bigger. However, the problem is that some of them appear to lay behind the others. and this is not the effect i want. If they are selected, they need to be in front of everything else temporarily. How can i do this through code?

Thanks in advance

Move the entity to front or the back of the children list. The UI is rendered in the order of children. (I can’t remember which order it goes in :thinking: )

1 Like

And how do i change the order of the children? i know that a parent has children and i think i have an idea but it would not be very performant… any ideas on how to change the order in a performant way?

Your best bet is to use reparent: https://developer.playcanvas.com/en/api/pc.Entity.html#reparent