Search Unity

Question Canvas - how does it interact with other elements on same level?

Discussion in 'UGUI & TextMesh Pro' started by NikoMeta, Apr 2, 2023.

  1. NikoMeta

    NikoMeta

    Joined:
    Aug 2, 2022
    Posts:
    10
    Hello!

    I realize that a canvas should be viewed/used as a surface on which to place sprites and images and other UI elements. But there remains a couple of question marks for me.

    1) I can add an image as a component onto a canvas. How should this be interpreted? I tend to assume that this image will be underneath all other UI-elements placed inside the canvas, but how then to account for view layers for example? What rule overrides the other?

    2) If a canvas (with an image attached to it as a component) is placed alongside other images or sprites, the element that takes precedence (i e is placed over the other on screen) is not defined, it seems. Depending on how I deactivate/activate the container (holding the canvas and other element on the same level as the canvas) during gameplay, the canvas image is drawn on top, or not. Do canvasses behave/interact differently as compared to more straightforward visual elements like sprites or text?

    Official documentation is surprisingly brief.

    Best regards,
    Niko