Search Unity

Question How do you sort without using hierarchies?

Discussion in 'UGUI & TextMesh Pro' started by SgerbwdGwyn, Feb 10, 2021.

  1. SgerbwdGwyn


    Dec 2, 2013
    (With 2021.1.1.0b1, URP)

    I have a canvas and elements populating that canvas, ordered and parented based on how they need to be aligned. I also have Image elements that should always be draw on top, or at least on top of most things.

    How do you sort canvas UI elements? After reading countless forum posts and documentation, the only way to sort them is by reordering them in the hierarchy, which conflicts completely with the hierarchy being used to align elements.

    Things I've tried:
    • Sorting Groups: Does nothing
    • Sprite Renderers: Don't seem to function with Canvas Renderers or canvases at all; they simply don't appear.
    • Multiple canvases with different sorting orders: Breaks up the hierarchies
    • Changing Z position on Rect Transform components: Does nothing
    How am I meant to do it?
    ShadowAngel likes this.