The rendering order of UI components follows two rules:
UICanvas instances follow a specific rendering order based on their RendererMode type.UIRenderer components under a UICanvas are rendered according to a depth-first order, from parent to child, and from left to right.Assume the current runtime:
SceneScene contains two cameras, Camera1 and Camera2Scene contains three canvases:
Canvas1 with WorldSpace render modeCanvas2 with ScreenSpace-Overlay render modeCanvas3 with ScreenSpace-Camera render mode, using Camera1 as the render cameraIt's important to note:
ScreenSpace-Camera render mode will only render with their corresponding camera, and they follow the general camera clipping rules, just like canvases with ScreenSpace-Overlay render mode.ScreenSpace-Overlay render mode can still be rendered without a camera.UICanvas follows these rules: canvases in the overlay mode have their rendering order determined only by sortOrder.As shown in the diagram above, the rendering order under the root canvas follows A -> B -> C -> D -> E -> F. It is important to note that setting UIRenderer.priority does not change its rendering order.