Author Topic: Widgets disappearing on iOS, Android  (Read 6716 times)

TericDragon

  • Guest
Widgets disappearing on iOS, Android
« on: May 10, 2012, 12:28:54 PM »
I'm using a UIDraggablePanel list in the UI in my game, and I've filled it with a number of UIDragPanelContents objects.  When I view this in the Unity Editor, it looks perfectly fine.  However, when viewed on Android, Kindle Fire, or iOS device, the entire list disappears, leaving some graphical artifacts in the shape of the widgets on my list.  (See Screenshot)

Any idea what's happening here?

In the screen shot, the lower-right panel is what I see in the Unity editor.  The other three shots are from an iPad 2.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Widgets disappearing on iOS, Android
« Reply #1 on: May 10, 2012, 02:32:52 PM »
Colored squares means shaders aren't working. This is either because you have shaders disabled, or because it can't Resources.Load the proper shader. Did you keep NGUI's shaders in the Resources folder?

TericDragon

  • Guest
Re: Widgets disappearing on iOS, Android
« Reply #2 on: May 10, 2012, 02:38:06 PM »
In my project, I currently have the NGUI resources folder here:

client-unity/Assets/NGUI/Resources  (There is a Shaders folder in that directory)

Does it need to be in this folder?

client-unity/Assets/Resources

TericDragon

  • Guest
Re: Widgets disappearing on iOS, Android
« Reply #3 on: May 10, 2012, 02:41:45 PM »
Also, how do I tell if I have shaders disabled?  Is it the checkbox on the Atlas?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Widgets disappearing on iOS, Android
« Reply #4 on: May 10, 2012, 02:43:29 PM »
That should be fine. You can check to see if it is able to find / load the shader by dropping an NGUIDebug.Log inside UIDrawCall's UpdateMaterials function, after line 110.

If you're building for ARMv7, then you have shaders enabled. ARMv6 = disabled.

TericDragon

  • Guest
Re: Widgets disappearing on iOS, Android
« Reply #5 on: May 10, 2012, 02:54:58 PM »
Okay, I'm looking into whether we have shaders enabled or disabled.

I wonder, though--if it turns out that we don't have shaders enabled when we build for iOS/Android, shouldn't all NGUI widgets show up as colored boxes?  From what I see, only the widgets on the UIDraggablePanel are disappearing, but all other NGUI widgets are showing up just fine.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Widgets disappearing on iOS, Android
« Reply #6 on: May 10, 2012, 03:06:08 PM »
No, only clipped panels switch widgets to use shaders.

TericDragon

  • Guest
Re: Widgets disappearing on iOS, Android
« Reply #7 on: May 10, 2012, 03:18:05 PM »
A colleague and I have figured out the problem--it turns out that our game is using OpenGL ES 1.1 on iOS and Android, which doesn't support programmable pipeline shaders.

Due to various performance issues, we have decided to stick with OpenGL ES 1.1 instead of upgrading to 2.0.  So, the answer is: we can't use the clipping functionality on the UIPanel.

As an alternative, I'm going to attempt to do clipping the old-fashioned way (i.e. physically place UI forward on the Z-Axis in order to block out the top/bottom of the draggable list).  This will result in some overdraw costs, but it might be the answer to getting the UI working properly on devices.

Thanks for the information, Aren!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Widgets disappearing on iOS, Android
« Reply #8 on: May 10, 2012, 03:25:50 PM »
You can do a scroll list like that without using clipping by using another camera. There is an example for that.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Widgets disappearing on iOS, Android
« Reply #9 on: May 11, 2012, 04:17:13 PM »
OpenGL ES 1.1 sucks. Support iPhone 3gs and above and only support OpenGL 2.0 like bosses. :D

If you're at the point where changing OpenGL versions is a bottleneck, there are other places to tweak first.

TericDragon

  • Guest
Re: Widgets disappearing on iOS, Android
« Reply #10 on: May 11, 2012, 04:38:25 PM »
I agree, Nicki--OpenGL 2.0 is much better.  However, we are now more than a year into development on our game, and recent attempts to port th game to OpenGL 2.0 have resulted in a severely decreased framerate.  We are researching the problem, but until we find a solution, we plan to stick with OpenGL 1.1.