Search Unity

[5.3] Elements in the UI flicker between different sprites

Discussion in 'UGUI & TextMesh Pro' started by CiroContns, Dec 10, 2015.

  1. FirePlantGames

    FirePlantGames

    Joined:
    Dec 11, 2012
    Posts:
    49
    Cool stuff! You guys are great! Keep up the awesome work.

    I found that if you don't move your canvas, it doesn't flicker AS much. (Nearly none) What I did was have an ortho camera that has the canvas as a child to that camera. The ortho camera only renders the UI layer, and the player camera doesn't render the UI at all. The ortho camera never moves in the scene. It seemed to work nicely. Still nowhere near a fix though.
     
  2. ExplodingTiger

    ExplodingTiger

    Joined:
    Jan 4, 2016
    Posts:
    5
    karl_jones likes this.
  3. asimov99

    asimov99

    Joined:
    Mar 13, 2015
    Posts:
    57
    Nice ! that's work now :) Thanks
     
    karl_jones likes this.
  4. x70x

    x70x

    Joined:
    Aug 20, 2011
    Posts:
    49
    The patch did not fix my issues at all. Everything still appears exactly as it does in my previous post.
     
  5. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    to verify you tried 5.3.2P1 not 5.3.2f1 right
     
    karl_jones likes this.
  6. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Ok, 5.3.2p1 fixed all flickering issues for me. Great work guys.
     
    karl_jones likes this.
  7. FirePlantGames

    FirePlantGames

    Joined:
    Dec 11, 2012
    Posts:
    49
    Do yours flicker in a frame, or are they like that all the time?
     
  8. ikarjon

    ikarjon

    Joined:
    Mar 31, 2013
    Posts:
    8
    5.3.2p1 also fixed all flickering issues that I has having. Thank you guys.
     
  9. rzubek

    rzubek

    Joined:
    Aug 21, 2014
    Posts:
    72
    Also confirming 5.3.2p1 fixed it for me! Glad to hear the bug's been found and squashed :)

    I'm curious if you can share any info on what would cause a bug like that? Just wondering, it had pretty unusual behavior :)

    Thanks again!
     
  10. FirePlantGames

    FirePlantGames

    Joined:
    Dec 11, 2012
    Posts:
    49
    Thanks for this Unity! All is working well so far!
     
  11. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Sure, So the issue was pretty much data corruption. What was happening was when we were uploading the shaderPropertySheets to gfx pipeline we were passing them by reference. What we needed to do was have them copied. This is because with Unity's threaded rendering back end the next frame was starting to be processed before the current frame was done being drawn. As you could likely imagine if the frame wasn't drawn before we started to recalculate the batch/ property sheets for the next frame you'd end up with invalid texture references in the current frame.

    Dont you just love threading :). I also have to give a big thanks to Karl for lending a hand even though the UI is not his responsibility. As a random note between the two of us it took a solid week of work (80 hours combined not including the late night and weekends) to find the issue to replace a total of 8 characters :).
     
  12. x70x

    x70x

    Joined:
    Aug 20, 2011
    Posts:
    49
    They flicker in a frame. The screenshot captures an exact frame where it occurs. And the gif shows me cycling between two buttons in my UI that cause the flickering to occur.
     
  13. x70x

    x70x

    Joined:
    Aug 20, 2011
    Posts:
    49
    Correct, I am using 5.3.2P1. Just double checked. My project folder is enormous, so it would not be reasonable to upload it for a new bug report.
     
  14. rzubek

    rzubek

    Joined:
    Aug 21, 2014
    Posts:
    72
    Ouch, that sounds really painful - gotta love threading, indeed. Thanks for the details, and once again cheers for finding and squashing it! :)
     
  15. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    So the flickering is exactly the same? Can you get a new screenshot with version 5.3.2p1?
     
  16. IzzySoft

    IzzySoft

    Joined:
    Feb 11, 2013
    Posts:
    376
    Too bad theres no utility script to check that its not Z Fighting with anything else! :p
     
  17. x70x

    x70x

    Joined:
    Aug 20, 2011
    Posts:
    49
    flicker1.gif

    I was able to catch it again and slow it down in a gif. I am using my keyboard arrow keys to navigate from the 4 icon to the 2 icon. For a single frame I get glitched text and sprites. The large numbers on each button are actually sprites and everywhere else is text. This seems to be the same issue that others were describing here. I am using the 5.3.2p1 patch that others have said fixed their problems, but it has not fixed mine. It has been a while since I have worked on my UI elements so I don't know for certain when this problem began, but I do not believe it was present for me in 5.1.
     
  18. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    It does sound like the same problem but like we said it should be fixed now so this must be something else. First just to be absolutely sure you really are using 5.3.2p1, the version from the patch download area? http://unity3d.com/unity/qa/patch-releases

    We really would need to see your project. We could provide some vpn details for you to upload but the best option would be if you cut the project down, this may also help you spot any issues.
     
  19. x70x

    x70x

    Joined:
    Aug 20, 2011
    Posts:
    49
    ss+(2016-01-28+at+06.47.36).png

    Definitely using the patched version. I'll see if I can take some time to create a reduced file size version of our project folder, but vpn details would be helpful regardless. Thanks for the quick reply. Hope to get this sorted out soon.
     
  20. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    Sure Il send you the details tomorrow. I need to sleep first
     
  21. ExplodingTiger

    ExplodingTiger

    Joined:
    Jan 4, 2016
    Posts:
    5
    So far, the new patch solved my issues as well, I was experiencing a HUGE amount of flickering beforehand.

    Many thanks to the Unity staff. Fingers crossed that annoying bugs like that won't ever come up in the future. :)
     
    karl_jones likes this.
  22. Gizmmoo

    Gizmmoo

    Joined:
    Feb 4, 2015
    Posts:
    10
    New patch solved my flickering. Thanks for the help guys!
     
    karl_jones likes this.
  23. Rizzonian

    Rizzonian

    Joined:
    Nov 28, 2012
    Posts:
    29
    Great job Phil and Karl! Fixed out issues! Thank you so much!
     
  24. WagDan

    WagDan

    Joined:
    Nov 7, 2014
    Posts:
    37
    Thanks devs patch works great.
     
    karl_jones likes this.
  25. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
  26. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    981
    What are you trying to say with your attached images? At least please provide some descriptions, even if you think it's obvious to yourself.
     
  27. CxydaIO

    CxydaIO

    Joined:
    May 12, 2014
    Posts:
    61
    5.3.2p1 fixed it for me as well.
     
  28. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221
    Are you guys testing 5.3.2p1 in the Editor? Coz on iOS (5s, 6s+, iOS 9x) even small test project with UI (1 Button) just shows empty screen, while working fine with 5.3.2 vanilla.
     
    Last edited: Feb 2, 2016
  29. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Hmm havn't personally tested outside windows editor/ standalone but i'll try and get to it today for ios and see.
     
  30. onis

    onis

    Joined:
    Aug 24, 2015
    Posts:
    1
    Is there some related issue that's still unfixed? I was following this and waiting for a patch, but unfortunately 5.3.2p1 still flickers for me. The project is under NDA so unfortunately I can't post a repro.
     
  31. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    There is no known issue that is unfixed. Can you create a simple project that shows the problem that is not under NDA?
     
  32. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221
    Any news?
     
  33. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    I am very angry with your guys,when i ask you about ETC1+ alpha features.You just delete my care and said "Your post in the thread [5.3] Elements in the UI flicker between different sprites was deleted. Reason: This is NOT related to this thread start a new one or search for the one that is already there about this. " Are you kidding me? If ETC1 does not have alpha texture,things would be all right.But if you set the Apha teture and MainTexture.The fliking problem should be appeared agin.@Phil-Unity you should ask sandbox and check this link http://forum.unity3d.com/threads/etc1-alpha-feature.350184/#post-2491053
     
  34. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    Yes!I am so sorry about when i use unity5.3.2patch2 ETC1+alpha features,I meet this problem.Please check this http://forum.unity3d.com/threads/etc1-alpha-feature.350184/#post-2491053 you could know all about how to flickers ui again.
     
  35. phil-Unity

    phil-Unity

    Unity UI Lead Developer

    Joined:
    Nov 23, 2012
    Posts:
    1,226
    Right but when you are asking for the ETC1 + alpha as a feature for the UI with no mention that when it is used it causes the same issue then yea the post is not related at all to the thread therefore they were deleted. The fact you are experiencing a flickering issue with a format that is not supported by the UI at this time is not necessarily a surprise but is still different then the issues described in this thread. I'd recommend not using the ETC1 + alpha at this time as it is NOT supported by the UI.
     
  36. ortin

    ortin

    Joined:
    Jan 13, 2013
    Posts:
    221
    So, whatever it was (probably something related to IL2CPP) it's fixed in the recent 5.3.2p2
     
    phil-Unity and karl_jones like this.
  37. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    Well,I don't think it's a format problem,It could be the different alpha value but the same uv texcoord.I test this problem,if i use the same atlas(fmt34) and the associated alphatexture (same uv fmt4) coord on the same UI ,There would never be flicker.But if i use different atlas at the same UI,the result you could see( flick).The key problem is your canvasrender dose not have a exposed API that just like Graphcs.DrawMesh can use materailproperty.Would you tell us the right time can be supported by the UI? Leader
     
  38. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    I used the associatedAlphaTexture the formt is RGBA(fmt4) as the following 1.png.
     

    Attached Files:

    • 1.png
      1.png
      File size:
      29.1 KB
      Views:
      901
    • 2.png
      2.png
      File size:
      83.1 KB
      Views:
      867
    • 3.png
      3.png
      File size:
      68 KB
      Views:
      834
    • 6.png
      6.png
      File size:
      39.8 KB
      Views:
      879
  39. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    The issue is that ETC1 with alpha textures are actually 2 textures with one representing the alpha.
    The shader needs to re-insert the alpha after sampling the second texture. This is how its done in the Sprites-Default.shader. This means that all UI shaders need to do this and requires using an additional shader keyword(they are in short supply). If you need it now then take a look at how Sprite-Default.shader handles ETC1 and port it over to the UI shaders. For your use case this is fine but we need to find something that works for everyone.
     
  40. johnpine

    johnpine

    Joined:
    Sep 19, 2015
    Posts:
    26
    Can't really confirm if something has been fixed because last 4 version of Unity makes crashing Android and iOS builds.
    Only way to get them not to crash on splash is to use Mono and stripping of.
    But the fonts are still broken. I just built with Unity 5.3.2p2 and on iPad I got immediately corrupt fonts on the screen.
     
  41. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    Have you reported these issues?
     
  42. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    981
    If you meant crashes on Android and iOS builds for previous Unity builds, would these be related?

    http://forum.unity3d.com/threads/unity-5-3-1-android-playerprefs-crash.380364/ (Fixed for 5.3.2p2)
    http://forum.unity3d.com/threads/un...nfortunately-project_name-has-stopped.372577/

    And this one confirms the crash issues are fixed in 5.3.2p1:

    http://forum.unity3d.com/threads/editor-crash-in-5-3-0-when-targeting-android.372831/

    However, like what @johnpine said, the last 4 versions of Unity (probably including patches between 5.3.0 and 5.3.1) is unstable for Android.
     
  43. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    So the crashing is fixed now but you still have a font issue? Is there a bug number for it i can look at?
     
  44. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    981
    Might need to wait on @johnpine, since he is the user with the font issue. I was just adding on to his post saying there are some issues with previous Unity builds.
     
  45. xjqxzyr

    xjqxzyr

    Joined:
    Jan 14, 2016
    Posts:
    21
    Yes,I did.But my project need ETC1 to decrease the apk file size.But i tried the sandbox's way use the shader like Sprites,and It just did not work.The UI element condition is more complicated than a single sprite.Can you give me a right solution or tell me the roadmap
     
  46. Aurore

    Aurore

    Director of Real-Time Learning

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    @xjqxzyr Our devs feel this is a separate issue, can you please create a new thread about this so we can keep conversation on topic, thanks.
     
  47. Klipi

    Klipi

    Joined:
    Feb 13, 2016
    Posts:
    4
    Ran into a bug that seems like this with 5.3.2p3. Repro package posted under case number 770460.

    GUI-bug-short.gif
     
  48. Cripple

    Cripple

    Joined:
    Aug 16, 2012
    Posts:
    92
    The patch 5.3.2p1 fixed flickering issues on my application, but if I switch my camera from Screen Space- Overlay to Screen Space - Camera, the flickering comes back again and is even worse than before.
     
  49. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,291
    Could you file a bug report please with the project?
     
  50. MaxProude

    MaxProude

    Joined:
    Feb 24, 2013
    Posts:
    175
    The patch fixed the issue for me. Nice work! Thank you very much!
     
    karl_jones likes this.