Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

how to disable Transparency Sort Axis in UI canvas?

Discussion in '2D' started by Haewon_2003, Sep 21, 2022.

  1. Haewon_2003

    Haewon_2003

    Joined:
    Jun 2, 2022
    Posts:
    7
    I using Transparency Sort Axis for my top down game (i want only sprite object) but I don't want set Transparency Sort Axis in layer UI
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,589
    So you know, this isn't the UI forum. The UI forum is here if you are asking specific questions and UGUI, Canvas, RecTransform etc.
     
  3. Haewon_2003

    Haewon_2003

    Joined:
    Jun 2, 2022
    Posts:
    7
    I’m sorry! This is my first time
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,589
    Not a problem! Just wanted you to be aware of where the UI devs live! :)
     
  5. karliss_coldwild

    karliss_coldwild

    Joined:
    Oct 1, 2020
    Posts:
    612
    The thing you are asking doesn't add up. Canvas objects don't use sorting axis so there is nothing to disable. Canvas objects are sorted based on the child order in transform tree. Also you shouldn't put sprites in canvas. In canvas you should use Image component, use Sprite(Renderer) only for non canvas objects.

    There are two different things you can do:

    I recommend creating your UI with Canvas using proper UI components. Which shouldn't be affected by sorting axis. There are also two different TextMeshPro components one for canvas and other for non canvas usage, use correct one matching to your setup.

    If you really want to create your UI using non UI components like Sprite, then you shouldn't use canvas and place your UI elements in separate sorting layer. When sorting 2d objects sorting layers (and sorting order property) have higher priority than sorting axes. So if you have properly setup the sorting layers and order to get desired drawing order, it shouldn't matter whether sorting axis get applied or not. Note "sorting layer" an "layer" are two completely different unity features."Sorting order" property and the order of children in transform tree are also two different things.
     
    Haewon_2003 likes this.