Hi ArenMook,
We're doing an optimization pass on our game and there were a couple things that I was seeing that might be candidates for optimization.
Currently in UICamera 1239 there is an alloc that is happening every frame due to:
inputHasFocus = (mCurrentSelection != null && mCurrentSelection.GetComponent<UIInput>() != null);
It's appearing as a 0.6KB GC alloc in the profiler. Would it be possible to check/remember the current selection's input by doing that check only when the selection is changed in Changed Selection? It appears that ProcessTouch/Mouse() methods set mCurrentSelection directly, but I'm wondering if they could go through the ChangeSelection coroutine and then only check for UIInput if a new selection was made?
My UI as a whole is consuming about 10% of my CPU frame time:
6% UIPanel.LateUpdate
3.1% UIRect.Update
1% UICamera.Update
These aren't awful by any means, but I notice that you were using the standard Update() on the UIRect. In the profiling tests that I've done, directly calling a MyUpdate() from a manager object is faster than relying on Unity's Update() call (which I would assume is using a slower reflection call). Since all widgets are managed by a UIPanel in the sense of draw calls, would it be possible to have each panel call a MyUpdate() on the widgets instead of relying on a Unity's Update()?
If I'm misinformed, please let me know.