Author Topic: Heavy performance impact and battery usage with complex menus  (Read 6485 times)

Ugur

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 60
    • View Profile
Heavy performance impact and battery usage with complex menus
« on: November 12, 2014, 09:11:17 PM »
So yeah, when having complex menus with scrollviews, lots of list items, anchored items around the screen etc, this has a way higher performance impact and battery using (on mobile devices) impact than it should.
I think this is due to good part due to the many UIRect/Anchor Update calls and UIPanel LateUpdate calls.
When i check the profiler, those NGUI things run constantly on all the items and have a considerably performance impact in total.
Ideally there should be a way where one can tell it to only Update when needed, which should be:
-when own or nested content (dimensions, color, pos, rotation, scale) changed
-when camera changed (position/rotation (,size for ortho cams))
-when screen changed (resolution/ screen orientation)
right now it is just calling all this stuff way too often (constantly).
And for anchors the option to do it only in start is no good either, let's say for cases like the device orientation changes and thinks should of course re layout, but then not re layout constantly anymore in update when nothing changed.

So yeah, would be great if there could be an option to do all those updates only when one of these 3 items is dirty/changed.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Heavy performance impact and battery usage with complex menus
« Reply #1 on: November 14, 2014, 04:36:24 AM »
Anchors will update every frame only if you set them to update in OnUpdate. It's rarely a good idea to do that.

Ugur

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 60
    • View Profile
Re: Heavy performance impact and battery usage with complex menus
« Reply #2 on: November 14, 2014, 06:45:19 AM »
The LateUpdate on all the UIPanels is called constantly and then also Updates on many UIRects.
Regarding the UIRects: on many of them i set it to not update every frame, but for many i also have to set them to update every frame.
That is because the app reacts to changing screen size and device orientation.
So as i said, there should be another option next to only once and constantly in update, which should be only when needed and should only be triggered when the content changes, the camera changes or the screen (resolution or orientation) changes.
So then all could reflow and then afterwards not running again until having to reflow again due to one of these setting it dirty for one frame

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Heavy performance impact and battery usage with complex menus
« Reply #3 on: November 15, 2014, 04:15:21 PM »
Screen size updates anchors anyway, assuming they are set to OnEnable.