Author Topic: HUD and floating text performance on mobile devices  (Read 4621 times)

Mike77

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
HUD and floating text performance on mobile devices
« on: September 05, 2013, 07:08:07 AM »
Good day.

I have several questions about NGUI performance of 2D games on mobile devices.

Am I right that NGUI is not a tool for creating the game itself? If I move a lot of sprites, their parent panel is updated each frame, which in my case causes some bottlenecks in refreshing the panel's geometry on low and mid-end Android devices.

I switched to 2d Toolkit to handle game contents, but HUD and floating text is still working under NGUI. I think there is still a performance problem, because floating text is just a pool of labels, which I often activate, move and scale. All labels belong to the same panel. How to handle this case? Shall I create a pool of panels, each with 1 label in it, and then move panels instead of moving labels? Or it would be better to switch floating text to 2d Toolkit as well, staying with more static HUD under NGUI?

I am talking about Android devices priced at 200-250$, as well as about iPhone 3GS, which seems to share the same performance issue.
« Last Edit: September 05, 2013, 07:22:06 AM by Mike77 »

Mike77

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: HUD and floating text performance on mobile devices
« Reply #1 on: September 05, 2013, 08:46:26 AM »
And I have one more question, but not on the topic. I can't find information, why GUI Camera is a child of GUI Root, and why each Panel is a child of GUI Camera? What if I move Anchor to GUI Root, can this affect performance?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: HUD and floating text performance on mobile devices
« Reply #2 on: September 05, 2013, 05:05:34 PM »
Whenever a widget inside a panel (drawn by that panel) is moved, the panel has to recreate the mesh it uses to draw everything it does - this means that if you have 1 panel with everything in it, moving a single widget is super costly.

If you put the moving widgets into their own panels, or at least have a not-movnig and a moving panel, then you can minimize the amount of widgets have to be used to recreate the mesh. Optimally, you can move the panel itself instead of the individual widgets, which would just move the entire mesh instead of recreating it.

UIRoot sets up the virtual pixels so you can set sizes in pixels by localScale and position it by localPosition in pixel sizes as well. The ui camera doesn't have to be a child od the UIRoot, but it has to be somewhere - might as well be in the hierarchy.


I'm not entirely sure how much you gain by switching to 2d toolkit, since they just have to do the same tricks you can do in NGUI. I suppose it's easier to set up as a 2d game engine, but I dunno.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: HUD and floating text performance on mobile devices
« Reply #3 on: September 05, 2013, 08:08:15 PM »
For 2D stuff I suggest you just use Unity 4.3 beta. It will keep getting better, and nothing will be faster than native 2D support.