Search Unity

Inexplicable UI flickering in 5.1.0f3

Discussion in 'UGUI & TextMesh Pro' started by Bennett-Lynch, Jun 11, 2015.

  1. Bennett-Lynch

    Bennett-Lynch

    Joined:
    Oct 11, 2014
    Posts:
    35
    After upgrading my project to Unity 5.1, some of my UI elements have begun to inexplicably flicker and disappear at random. I have scoured the change log looking for a possible explanation but I cannot find any potential culprits. The best way I can explain the problem is with these two short videos:

    Working 5.0 UI


    Broken 5.1 UI


    I have rows of "action buttons" that are made up of various Unity UI elements, but they are primarily just basic buttons with an image component. Each button is instantiated from the same button prefab and they are assigned different sprites to use at runtime. Each button registers itself with an event from another class that will inform it when it needs to perform its update/cooldown routine.

    The bulk of the button-updating logic is handled in this script. That script is the only location in the entire project where the sprites are enabled or disabled during runtime. I added two simple debugging messages in the methods that hide the UI elements, but that code is not being reached when the UI is flickering on/off. This leads me to believe that it is a bug on Unity's end but I'm not sure what more information I can provide to help diagnose it.

    The code and logic for handling these buttons was completely unchanged when upgrading from version 5.0 to 5.1. And as you can see in the second video, the UI elements will disappear seemingly randomly when just moving the camera around. Perhaps most perplexing is that only some of the buttons will be affected when they are all instantiated from the same prefab.

    I realize I'm not providing much information to work with, but I'm simply not sure what I can do to try and diagnose or fix this problem. If anyone has any advice to help debug this further, or is aware of this being a known bug, I would greatly appreciate any help.
     
  2. Bennett-Lynch

    Bennett-Lynch

    Joined:
    Oct 11, 2014
    Posts:
    35
    After giving it some more thought, I think this might be related to two Draggable and Droppable scripts I have attached to each button. When viewing the button prefab in the inspector, the check box that usually allows me to enable/disable scripts is not present. The scripts are not generating any compiler warnings or errors though. Is there any reason that the behavior of these scripts may have become broken in this patch?
     
  3. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,689
    Can you replicate the issue is a blank scene (or better yet a fresh project)? So that these no other script interfering with it.

    Seen similar issues with using prefabs with UI but these were resolved in the 5.0 timeline.

    @phil-Unity @Aras any ideas why this is cropping up?
     
  4. Bennett-Lynch

    Bennett-Lynch

    Joined:
    Oct 11, 2014
    Posts:
    35
    My scripts for these buttons are so highly coupled with others in the project that it would be difficult to test it completely by itself.

    I did test it using a button prefab without the Draggable and Droppable scripts mentioned above, but the problem still occurs. I'm going to go ahead and submit a bug report and reference this thread. I'll submit my entire project if it's not too large so that they can take a look at it in action.
     
  5. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Bennett-Lynch likes this.
  6. Bennett-Lynch

    Bennett-Lynch

    Joined:
    Oct 11, 2014
    Posts:
    35
    This does seem to be directly related to my problem. Thank you very much for bringing it to my attention.
     
  7. Democide

    Democide

    Joined:
    Jan 29, 2013
    Posts:
    315
    I had similar issues, which seem to be gone now that I have removed the child-depth of my UI a bit.
     
  8. Devil_Inside

    Devil_Inside

    Joined:
    Nov 19, 2012
    Posts:
    1,119
    Yeah, my reproduction case consisted of a scene where you can remove a single object and the bug goes away.
     
  9. Bennett-Lynch

    Bennett-Lynch

    Joined:
    Oct 11, 2014
    Posts:
    35
    Can you elaborate on this? Do you just mean you reduced the number of different nest levels?
     
  10. Kim-Shin-Wook-a-k-a-Forward-of-South-Korea

    Kim-Shin-Wook-a-k-a-Forward-of-South-Korea

    Joined:
    Sep 29, 2014
    Posts:
    3
    This issue still remain in .1p1 :(
     
  11. nixius

    nixius

    Joined:
    Mar 4, 2015
    Posts:
    37
    I'm also still getting similar flickering in .1p1. Is there any update on this?
     
  12. Bennett-Lynch

    Bennett-Lynch

    Joined:
    Oct 11, 2014
    Posts:
    35
    Patch 5.1.1p2 fixed it for me.
     
  13. nixius

    nixius

    Joined:
    Mar 4, 2015
    Posts:
    37
    Thank you for your reply Bennet. I have downloaded 1p2 and I still have a flickering issue. I took a video and made a gif of it which I hope is attached correctly; perhaps this is a different issue to the one you were having then?

    What I am doing here is Canvas1.gameobject.setActive(false) and Canvas2.gameobject.SetActive(true) at the same time. It looks like it does some pretty weird stuff!

    Canvas1 is basically a 'landing' to other menus. Canvas2 is a bunch of InputFields. It looks like Canvas1 is faded off, then on, then off again as Canvas2 is then shown.
     

    Attached Files:

  14. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    Also I have same issue.
     
  15. sniperisa

    sniperisa

    Joined:
    Sep 20, 2015
    Posts:
    18
    I had the same issue: I fixed it by deactivating the "Pixel Perfect" - Checkbox on the Canvas!
     
  16. Soumya

    Soumya

    Joined:
    Jan 14, 2013
    Posts:
    8
    I have the same issue in 5.3. Seems to go away if I have the scene view visible while in play mode.
     
  17. RoyalCoder

    RoyalCoder

    Joined:
    Oct 4, 2013
    Posts:
    301
    Hi @Bennett Lynch , did you managed to fix this issue, I have the same problem and can't fix it :(
     
  18. H-GameProgrammer

    H-GameProgrammer

    Joined:
    May 13, 2015
    Posts:
    2
    It is a bug in Unity 5.3.x. I uninstalled Unity 5.3.1 and installed Unity 5.2.3. It solved the problem 100%.
     
    RoyalCoder likes this.
  19. martibergoglio

    martibergoglio

    Joined:
    May 28, 2015
    Posts:
    14
    Hey i have the same problem, im working on Unity 5.4.0p1 and i cant resolve it. Any ideas?
     
  20. Supergeek

    Supergeek

    Joined:
    Aug 13, 2010
    Posts:
    103
    I had this problem with a custom editor window and dynamic textures. I refactored to just pre-allocate the textures into a texture array instead of reusing one texture over and over, and the flickering went away. I was trying to save memory, but oh well.