I would like certain UI components to be drawn on top of others in order to make them noticeable to the player
Cause when I move some UI components via script, they always are rendered behind other UI components. Is there a way I can make it so that I can selected which UI components render on top of one another?
Like how it is done in the 2D world with render layers, can UI components also use render layers?
Two approaches:
- The order they appear in the hierarchy affects their sort order. Lower down in the hierarchy means on top of objects above it, if the objects are in the same canvas.
- If you have multiple canvases, you can set the Sort Order of the canvas it affect which canvases are draw on or under other canvases.
I tried that but see the problem is that the script causes some UI elements to float and fly towards a score board and the UI elements move randomly because they are set up to represent a board and, for example, tile one may fly to the score board or tile 100 so you see, sorting them in the hierarchy doesn’t really help because they move at random
Then how do you want to sort them? If you have 100 things all floating around screen, and some overlap others, you’ll need to decide which should be on top. Which do you prefer be on top? Are you saying that at some point, an arbitrary tile will float to the score board, at which point it should be on top of all other tiles? If so, one easy approach would be to deparent then reparent that image, which would put it at the bottom of the list in the hierarchy, and put it visually above another else in that directory.
Thank you so much. That will work:)