Author Topic: NGUI 3.8.2 + GLES2.0 not working with latest unity (5.1.3p3)  (Read 2911 times)

Raimis

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 5
    • View Profile
NGUI 3.8.2 + GLES2.0 not working with latest unity (5.1.3p3)
« on: August 20, 2015, 06:45:27 AM »
Hi, we have updated our project to NGUI 3.8.2 some time ago and now after updating unity from 5.0.3p3 to 5.1.3p3 the NGUI content is no longer rendered on iphone 5 (works fine on ipad air 2 running metal; on iphone 5 tried both il2cpp and mono backends). Any ideas where to start digging? Last resort is to upgrade NGUI once more, but I made a lot of changes to original code making it treat TextMeshPro as one of it's components in terms of localization and layouting. Would hate to do that again.

Any help would be appreciated. This should be a quick fix related to camera or some core controls in ngui, wish i could mod them on existing version rather than updating whole ngui framework. Thanks in advance for any tips and suggestions.

EDIT: Ok, after digging further, there must have been a change in unity related to how cameras work. NGUI stops working (even 3.9.2) after camera is changed to Don't Clear. For us this was an option since we draw background manually over whole screen each frame anyway. This is NGUI problem, cause Text Mesh Pro works fine, it's just NGUI that fails to render.
« Last Edit: August 20, 2015, 11:05:46 AM by Raimis »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI 3.8.2 + GLES2.0 not working with latest unity (5.1.3p3)
« Reply #1 on: August 22, 2015, 02:24:30 AM »
"Don't render" is a bad choice to begin with. You should at the very least clear depth before drawing the UI.

And make sure that at least one camera is set to clear color or skybox (the first camera to draw).

Raimis

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 5
    • View Profile
Re: NGUI 3.8.2 + GLES2.0 not working with latest unity (5.1.3p3)
« Reply #2 on: August 24, 2015, 07:48:20 AM »
Hi again,
Thank you for your reply. If we are making sure that we overdraw background area every frame all the time, how can "Don't clear" be a bad choice? Maybe I am missing something. What we have is stretched bg with fancy shader that does blending and smooth transitions between the screens. By using don't clear we get rid of extra draw call that doesn't do anything for us. This used to work on older unity + this still works on metal. It's just something that doesn't work in gles, though other frameworks still work fine.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI 3.8.2 + GLES2.0 not working with latest unity (5.1.3p3)
« Reply #3 on: August 26, 2015, 12:07:59 PM »
Please re-read my reply and note what I said about clearing depth. It has nothing to do with overdraw. UI is drawn after everything else, if your depth buffer isn't cleared, what happens is undefined.

In short, every time you switch from one camera to another you need to clear depth. This isn't an NGUI-specific thing.