16
NGUI 3 Support / Re: What is forcing UIScrollBar Background to disable when value is 0
« on: February 01, 2016, 04:04:19 AM »
Working like a charm, thank you
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
The fact that having every script have its own Update() function vs having a single Update() in a manager that calls child updates has been like that since Unity's inception. It wasn't a secret, there just wasn't a blog post about it. It's the same about all functions. There is overhead every time C++ to C# boundary is crossed. Once you're in C#, it's faster to stay there if at all possible.
I tried it before but realistically there was little noticeable difference in performance and there were odd side-effects related to going from play mode to edit mode that were fixed by using Update() in widgets. Also note that if things are not visible you should keep their game objects disabled anyway, implying their Update() won't run.
If you want to go with the reduced Update() just to try it out, you can try it yourself easily enough in 2 simple steps:
1. Rename UIRect.Update() to UIRect.CustomUpdate().
2. Add this function to UIPanel:
void Update () { for (int i = 0, imax = widgets.Count; i < imax; ++i) if (widgets[i].panel == this) widgets[i].CustomUpdate(); }
P.S. As for ETC1 stuff... that will never happen. Android is just one platform. NGUI needs to work on all of them.
Hey Michele & r.pedra,
Thanks for reading. I sorta felt the "use static" would be painfully obvious, but I mainly wanted to show the numbers associated to make it clearer just how much it helps.
I purposely didn't make a comparison with 2.7, because there have been so many underlying changes that it's not a fair comparison - performance in certain areas, like huge scroll lists, have been sacrificed in order to have explicit ordering the way it is now and other feature improvements.
There are ways to combat this, by not just putting all objects in but instead using containers which you fill with information when they're supposed to draw - then you're generally limited to <10 containers at any one time vastly increasing your performance (and making unlimited scroll lists possible).
NGUI does not do this internally at this point, and it's up to the individual developer to implement this. Without changing the scrollviews fundamentally, it's not something that's easily done on NGUI's end.