Author Topic: performance question - 1 panel rebuilding vs. multiple panels with fewer widgets  (Read 2003 times)

andrejvojtas

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 19
    • View Profile
Hi,

I have read trough quite a few performance related posts here, but came up empty.

My setup: I have a 1 drawcall UI, as I use 1 panel and 1 atlas for everything. On Start() I generate lists of widgets representing the various part of the UI. Then as needed I manually enable and disable widgets via NGUITools.SetActive() to show and hide parts of the GUI. The panel reaches up to 100 widgets, enabling and disabling groups of about 20-50 at a time.

The question: would it perform better, if I added a UIPanel to each group? If I understand it correctly adding more panels adds drawcalls, but they would be probably batched, as they use 1 atlas right? The reason I ask is, I read the UIPanel buffer rebuilds everytime a widget is enabled / disabled and the more widgets it has, the slower the rebuild. What is more expensive: adding 2-3 drawcalls or rebuilding 2-3 times a panel with ~ 100 widgets?

Thank you for your time.
« Last Edit: September 03, 2013, 03:39:07 AM by andrejvojtas »

sisso

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 46
    • View Profile
I was very curious about it and had the same question when started my GUI. But later I thought, if I can't see in my profile test, It don't bother me :P

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Disabling a panel won't be faster. When you disable a panel, it releases the draw call. When you re-enable it, it has to re-create it. It's better to stick to one panel, many widgets in this case.

andrejvojtas

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 19
    • View Profile
Thank you for your answers, I really appreciate it :)