Author Topic: Animation within a UIPanel and performance  (Read 5653 times)

MikeMoki

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Animation within a UIPanel and performance
« on: February 15, 2013, 04:38:21 PM »
I was wondering the best approach for animating postion / scale of UIWidgets that are under a UIPanel.  Application requires a lot of movement and scale changes that will be happening every frame.  Currently hitting a performance bottleneck with UIPanel.LateUpdate and specifically the UpdateTransforms method while animating a few dozen widgets.  Are there any tricks to making this more performant or is this just not a good use case for NGUI?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Animation within a UIPanel and performance
« Reply #1 on: February 16, 2013, 01:58:23 AM »
Adjusting transform of panels = cheap. Adjusting transform of widgets = expensive. Group changing things into their own panels so that their updates don't affect other widgets, and animate panels instead of widgets whenever possible.

mixd

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Animation within a UIPanel and performance
« Reply #2 on: February 18, 2013, 01:50:16 AM »
Try Futile:
https://github.com/MattRix/Futile

Doesn't seem to differ much from NGUI in terms of the core technique they use to render things, so it seems completely possible to free NGUI of this limitation someday.

Check it out -- very cool engine. I'm finding that NGUI really isn't suited for 2D games due to UpdateTransforms, which is unfortunate because it is always nicer to use a single library.

With Futile, I can get 15,000 2D objects (60,000 verts) on the screen all at once, all animating at the same time. Not that you'd need that many objects in a single game view, but point is, it's fast -- just not as convenient for simple UI. (Forgot to mention this is on an iPhone 4s)
« Last Edit: February 18, 2013, 01:51:58 AM by mixd »

mixd

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Animation within a UIPanel and performance
« Reply #3 on: February 18, 2013, 03:18:52 PM »
Aren -- was hoping to get your take on this, and wonder if NGUI might someday re-implement its core drawing functions to have performance comparable to something like Futile? Would love to be able to use NGUI as my sole 2D library in all projects! (Like for an RTS or TD game or something)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Animation within a UIPanel and performance
« Reply #4 on: February 18, 2013, 05:05:04 PM »
There have already been some changes inside Unity itself that make the UI faster (4.1). The only other thing that would improve its performance would be a more clever way of filling the draw buffer -- but that's on the theory list for the time being.

mixd

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Animation within a UIPanel and performance
« Reply #5 on: February 21, 2013, 07:23:37 PM »
Hmm. Have you looked into Futile? It's really in a different realm of performance. Yet effectively renders the same way as NGUI. See absolutely no reason why NGUI couldn't also be this fast. Gotta be a core difference somewhere. We are talking many orders of magnitude, especially when there are only a few objects moving on a large mesh.