1
NGUI 3 Support / Re: Slow frames when enabling panels with many widgets
« on: April 04, 2014, 06:02:33 AM »
Thanks for the reply!

But why do you think this is not a healthy structure?
For me it is a fixed cost, instead of having big performance problems when enabling, disabling widgets.
This could be a nightmare on mobile. Similar situation is with shaders, that needs to be warmed up before usage.
Unity recognized this problem with shaders and added Shader.WarmupAllShaders, so that we can prevent big perf drops during gameplay:
http://docs.unity3d.com/Documentation/ScriptReference/Shader.WarmupAllShaders.html
So, the issue is actually not that the UIPanel keeps or loses the reference, it's that the Panel has another dedicated drawing class (UIDrawCall) which uses the custom geometry that UIpanel supplies and draw stuff on the screen with that. So making UIPanel "lose reference" just means that it doesn't provide the geometry from the given widget.Thanks for explaining. Still I see UIPanel as the one responsible for facilitating this process

Each time a new widget needs to be added, the entire geometry from that panel needs to be rebuilt, which takes time. There's no real way around this part, since moving widgets around has the same effect.I think you are wrong, because when moving a widget, there is a possibility of changing panels, widget position etc., thus the need to rebuilt geometry. But when I simply want to hide the widget and I know that it will not change it's panel/drawcall then the geometry would not have to be rebuilt.
Arguably, you can make a certain part of the geometry be drawn as normal but with alpha = 0, so it's not visible, but I'm not sure this is a healthy structure at all.I do not know how to solve it internally. Thanks for the pointer.
But why do you think this is not a healthy structure?
For me it is a fixed cost, instead of having big performance problems when enabling, disabling widgets.
This could be a nightmare on mobile. Similar situation is with shaders, that needs to be warmed up before usage.
Unity recognized this problem with shaders and added Shader.WarmupAllShaders, so that we can prevent big perf drops during gameplay:
http://docs.unity3d.com/Documentation/ScriptReference/Shader.WarmupAllShaders.html