Hi,
I've been having some lag issues on the iOS devices (it's not really noticeable on PC).
My situation is the following:
I have an invisible widget (Let's call it "Game") that has a lot of children.
More specifically "Game" has 90 invisible widgets as children which in turn each have their own children and all those also have a collider on them because they need to be buttons. In case you're wondering why the hell I'd need 90 buttons on a regular UI, it's a board game made in NGUI.
There's a function that programmatically generates the aforementioned "Game" gameobject and this function is called in Unity's Awake().
The "Game" gameobject itself is inactive at the start but the generation happens nonetheless without a problem.
When the player presses play, that's when the "Game" gets activated and that's when I get a huge spike in profiler and a lag on devices.
In profiler, it says that UIWidget.CreatePanel()'s and UIPanel.UpdateSelf() are responsible for this lag.
I'm attaching a profiler screenshot below in hopes that someone can explain to me what am I doing wrong optimization-wise.
Is NGUI not designed to handle such amount of widgets at once or am I the one to blame for not using it correctly?
P.S. I did find a work around by having "Game" enabled at the beginning and disabling it at the end of the first Update() cycle, but I would still like to understand NGUI better and prevent such cases from happening in the future.
Thanks