Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Is there a way to ignore sorting by hierarchy?

Discussion in 'UGUI & TextMesh Pro' started by Tafk, May 5, 2016.

  1. Tafk

    Tafk

    Joined:
    Feb 5, 2013
    Posts:
    20
    In my hierarchy CandyItem has an Image component attached to it, so do CandySprite. I want CandySprite to be renderer on top of all CandyItems, not only the one it's parented to. Right now it seems impossible to me since CandySprite will always be below in hierarchy to some of the CandyItems.
    I can create two separate container and sort those, but it seems like a bad design.
     

    Attached Files:

  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    use http://docs.unity3d.com/ScriptReference/BaseHierarchySort.html
    or

     
  3. Tafk

    Tafk

    Joined:
    Feb 5, 2013
    Posts:
    20
    Hi, thanks for response!

    I think it only affects Hierarchy window representation and doesn't affect rendering order, doesn't it?
     
  4. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
  5. Tafk

    Tafk

    Joined:
    Feb 5, 2013
    Posts:
    20
    Well, yeah, I know I can add a Canvas to each item, but I can have like 20 of those at the same time and it seems like Unity makes draw call for every Canvas so it's not really an option.
     
    Last edited: May 5, 2016