Author Topic: UIPanel for every view or just one big?  (Read 1467 times)

ixque

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
UIPanel for every view or just one big?
« on: April 08, 2014, 04:10:54 AM »
I'm having trouble understanding the concept of UIPanel and the impact they have on performance. Currently i'm developing an UI heavy mobile app and i have like 20 different views. One view can be active at a time and you can switch to other views via fancy transistions. My views consist of simple (static) sprites, but also scrollviews with UIGrid's which have lots of items.

I've seen http://www.tasharen.com/forum/index.php?topic=5787.0 this thread, which tells me about UIPanels and on splitting static content from dynamic moving content, but i'm confused as if the scrollviews in my views are also considered to be dynamic moving content. Also, i use some fancy transistions to change views, like pushing the view on top of the other by tweening the position of the view's gameObject.

Instead of having 1 UIPanel containing all views, would it be faster to have different UIPanel for every view? Because only 2 views can be active it would only increase the drawcall count by 1.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UIPanel for every view or just one big?
« Reply #1 on: April 09, 2014, 04:00:50 AM »
No, scroll views are not considered to be dynamic moving content because when you scroll a scroll view, you are moving a panel. You only get the performance hit if you're moving or modifying widgets inside a panel. Moving panels around is quite efficient.

The idea behind moving things to separate panels is that if you have something changing every frame (like some slowly animating gradient), then it's more efficient to put it on a separate panel so that its change doesn't affect other widgets. All widgets get batched into as few draw calls as possible, so if you have 1000 widgets and one of them is changing, it will cause all 1000 widgets to re-fill their geometry, which is far less efficient than just one.