Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. 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
  8. 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.