Author Topic: Problem with shaders on initial scene startup  (Read 9051 times)

Razhagal

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 14
    • View Profile
Problem with shaders on initial scene startup
« on: May 14, 2015, 04:13:00 AM »
    Hello. Recently we updated to Unity 5 and started having issues with some scenes. When they are initially loaded they appear all black with only fonts showing as colored rectangles. When you tap somewhere it fixes itself and all looks well again. I've attached few screenshots with initial black state and the proper state after a tap.
    This only happens on iOS devices, most notably on iPhone 5/5S. In editor view and Android devices there's no problem. We tried different things like playing around with the build settings, quality settings, even went on to recreate some of the scenes from scratch to see if it'll fix itself but none of them worked. We played around with different NGUI and Unity shaders to see if there will be any change and we found out that when we switch to Unity shaders the black screen is gone. It seems like the problem comes from NGUI shaders not working too well with Unity 5 maybe?
    The black screens problem only occurs on some scenes, not all for some reason. We also found that the atlases size might have something to do with this but then we tried our best to shrink used atlases on some of the problematic scenes down to 1024x1024 max but still no change.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem with shaders on initial scene startup
« Reply #1 on: May 14, 2015, 06:10:01 PM »
Black in Unity means unsupported texture format. What texture format are you using?

Razhagal

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 14
    • View Profile
Re: Problem with shaders on initial scene startup
« Reply #2 on: May 15, 2015, 02:22:44 AM »
All our textures we use in Truecolor format without mip maps generation. It didn't had that problem before upgrading to Unity 5. Not sure if they changed something about the textures to be honest. Also if the format wasn't supported why would it fix itself when you tap on the screen?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem with shaders on initial scene startup
« Reply #3 on: May 22, 2015, 03:28:04 PM »
I can't say I have an answer to this question for you. Perhaps check with Unity.

Razhagal

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 14
    • View Profile
Re: Problem with shaders on initial scene startup
« Reply #4 on: May 23, 2015, 05:57:39 AM »
Well we did find that the NGUI shaders were causing the problem since none of the Unity shaders made a black screen on start. Unfortunately none of my colleges know how to write shaders (or at least good ones) so maybe you could try looking more into them? Or could NGUI not be fully compatible with Unity 5 still?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem with shaders on initial scene startup
« Reply #5 on: May 26, 2015, 02:48:45 PM »
You aren't giving me much to work on here. You say it happens on some, but not all. As I also understand it it happens only on your iOS device. Did you try the examples what come with NGUI? Everything works as expected as far as I know, and I have not heard of anyone experiencing similar issues. The best I can do is have a look at an example you can provide that reproduces the issue.

Razhagal

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 14
    • View Profile
Re: Problem with shaders on initial scene startup
« Reply #6 on: May 27, 2015, 06:56:07 AM »
    Hello again. I didn't though about testing with the example scenes. I tried something else today first - I created completely new scene out of scratch. No logic, just few elements thrown here and there. Re-imported some textures a new and created new atlas only for them (no bitmap generation, truecolor formats). The end result was again black screen like the screenshots from the initial post. After that i added all the example scenes from NGUI to the build. Tested on Android. No problem. Tested on iPhone 5 and 5c and all 16 scenes except 2 were black or like the screenshot i`m providing bellow.
    On example 5 (the one with the flying cubes) it's black initially but when i manage to hit the button that shows the cubes everything shows up properly. Example scenes 11 (Drag & Drop) and the one with the orc are completely fine. No problems with them at all. Few other scenes (12 and 14 for example) are like attachment.
    We tested on iPhone 5, 5C and 5S (iOS 8.3) and 6. The problem only occurred on 5 and 5C. Not on 5S and 6. We will try testing on more 5's and 5C's these days and will provide more feedback on the results.

« Last Edit: May 27, 2015, 07:02:03 AM by Razhagal »

Razhagal

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 14
    • View Profile
Re: Problem with shaders on initial scene startup
« Reply #7 on: June 24, 2015, 12:25:02 PM »
It's been almost a month since last reply. Just wanted to post that updating to Unity 5.1 fixed all problems with the black screens. We didn't find a solution in the end, it just got solved by itself with new Unity version.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem with shaders on initial scene startup
« Reply #8 on: June 25, 2015, 08:57:45 PM »
Good to know, thanks!