Search Unity

  1. Full schedule for #UniteBerlin is now available! Featuring talks on our roadmap, hands-on labs and much more! Check it out!
    Dismiss Notice
  2. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  3. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Unity UI UI Canvas subelements drawn in wrong order

Discussion in 'Unity UI & TextMesh Pro' started by JuhoLyde, May 16, 2018.

  1. JuhoLyde

    JuhoLyde

    Joined:
    Nov 5, 2015
    Posts:
    1
    Really hard for me to explain what the actual issue is but I'll try to describe what's going on.

    Essentially I have a sub gameobject under a canvas that is drawn before/under a another sub gameobject that exists in an canvas that is positioned lower/earlier in hierarchy. Issue can be reproduced easily but requires a very certain steps in terms of activating elements in different canvases.

    Scene Hierarchy:
    Root Canvas
    <other objects>
    - Sub Canvas A
    ---Panel GameObject 1A
    - Sub Canvas B
    -- Panel GameObject 2B
    -- Panel GameObject 3B
    <other objects>

    Required Sequence:
    > Open "1A"
    > Open "2B" (1A stays open)
    > Close "2B"
    > Close "1A"
    > Open "3B"
    > Open "2B" (3B stays open)
    > Close "2B"
    > Close "3B"
    > Open "1A"
    > Open "2B" (1A stays open)
    -- Issue is visualized:
    * 1 stays on top of 2

    order canvas sub elem issue.png
    Sequence visualized: slide 3 should be the correct order of things instead of the end slide.

    Notes:
    Current hierarchy contains many nested canvases (some contain no active content on scene load)
    Open enables and tweens the gameobject child content scale and canvas group alpha (dotween)
    Close tweens child content scale and alpha and disables it.
    Canvas.ForceUpdateCanvases had no effect
    Canvas.Rebuild ( CanvasUpdate.PreRender/Layout ) [no effect] < on panel to be opened (shared baseclass)
    Moving some objects around manually in hierarchy fixes the issue.