Figure: Diagnostic workflow: Canvas render mode → Hierarchy/sorting settings → Inspect actual draw order
Figure: Diagnostic workflow: Canvas render mode → Hierarchy/sorting settings → Inspect actual draw order

Cause and mechanism

How UI overlaps 3D objects depends on the Canvas render mode. Check order within the Canvas, Renderer sorting, and depth testing separately. A CanvasGroup groups UI behavior but does not set Sorting Order. Moving the Z position alone cannot solve every case, so start by identifying the Canvas mode.

Check and correct the setup

  1. To interleave background UI, a 3D effect, and foreground UI, use separate canvases/cameras or texture composition.
    Inspect input targets in front
    Inspect input targets in front
  2. For nested canvases, configure Override Sorting and orders explicitly; check particle sorting and render queues too.
    Inspect input targets in front
    Inspect input targets in front
  3. Check camera-relative depth, clip planes, plane distance, and depth tests/writes in Frame Debugger.
    Inspect input targets in front
    Inspect input targets in front

Limits and verification

Sorting changes do not necessarily override depth occlusion. Keep CanvasGroup opacity/raycast settings separate from rendering order.

A focused diagnostic setup

Use one background image, one particle effect and one foreground button. State the required background/effect/button order explicitly.

Test in this order

  1. Verify UI ordering alone and split canvases if needed.
    Inspect input targets in front
    Inspect input targets in front
  2. Restore the particles and inspect actual Canvas/Renderer draw order.
    Inspect input targets in front
    Inspect input targets in front
  3. Vary distance and view to test depth, plane distance and queues.
    Inspect input targets in front
    Inspect input targets in front

Interpret the result

Correct draw order can still fail depth testing. Revisit materials and composition instead of endlessly raising Order. A dedicated camera/RenderTexture is another option for embedded 3D previews.

Related explanations

References