Replies: 1 comment
-
This is absolutely correct, this approach could indeed improve performance in Unity when working with complex UI elements. Unity's rendering system does have specific ways of handling active/inactive UI elements, and calling
Finaly call |
Beta Was this translation helpful? Give feedback.
-
In Unity optimization guidebook (I think I read it) it says. When we pool a UI element, we often set it active then modify it, causing double render.
So having an optional
Action callback
to setup elements before setting it active only when the object is from pool (not when created first time) would provide performance improvements.Like this
Callback has limitations like what if you spawn 20 items in a
GridLayout
for each item it would redraw full canvas.So having a new method
RequestInactive
would be the best solution. Or we can just spawn UI element with parent null then attach to canvas. (Have to call set TransformSetIndex later)I am saying it because when we build a complex ui with lots of item setActive it can add up.
Let me know if it's crazy talk or not.
Beta Was this translation helpful? Give feedback.
All reactions