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

Problem with depth, bug?

Discussion in 'UGUI & TextMesh Pro' started by barbe63, Jun 5, 2015.

  1. barbe63

    barbe63

    Joined:
    Oct 6, 2014
    Posts:
    35
    depthbug.jpg Hello, I encouter some strange behaviour when i'm trying to change the textures on the run from some button with an Image. The image appears to be behind my menu even if I move the button in the z axis like above.



    I removed the image because the white apparance makes it more obvious.

    As you can see the flag inside it, which is a child, doesn't have the same issue.

    My guess is it's a bug but what do you guys think about it?

    The most curious about it is the english flag button never have this problem, but I triple checked it, it's exactly the same!

    Edit: I can fix it on the run by dragging the gameobject into the hierarchy, the same that it is assigned. It don't even moved his rank. Problem is it still happen when i run it again. Definitly a bug.
     
    Last edited: Jun 5, 2015
  2. barbe63

    barbe63

    Joined:
    Oct 6, 2014
    Posts:
    35
    I found out 2 things...

    First it have nothing to do with the swaping of the sprites. I removed all the scripts and it still occurs.

    But the major discovery is very weird: If I drag the gameobject to the left a bit, it's working. To the right again and same issue.

    More weird, if i copy the button to another menu the problem is gone... wt#??

    It's so funny really, I paste it ANY other menu and it works. Only the one I need it doesn't. All i'm doing to opening my different menus is the same function which is only activating a gameobject...!!!
     
    Last edited: Jun 5, 2015
  3. barbe63

    barbe63

    Joined:
    Oct 6, 2014
    Posts:
    35
    After long time struggling I discovered the image was not making a problem when it was rendering over something else. So the workaround is put a transparent image behind inside the same hierarchy...

    Wow!
     
    SimonDarksideJ likes this.
  4. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,685
    That is a very curious issue @barbe63
    I'd log a test case in the Unity bug reported from the editor with a sample repo if you can.

    That is certainly not the most efficient way to handle that and having to add "empty" images seems wasteful.

    Great find and workaround for now.
     
  5. Deleted User

    Deleted User

    Guest

    Thanks @barbe63 I´ve been smashing my head for so long trying to figure this out. It´s a bug for sure but thanks for sharing the fix.