1
NGUI 3 Support / Re: Slow frames when enabling panels with many widgets
« on: May 21, 2014, 09:41:17 AM »
This is an issue in our game as well on NGUI 3.5.7. At the root of every UI pop-up the player sees is a panel. Usually only 1 or 2 are visible at a time. We enable/disable the root of these panel/widget hierarchies to toggle visibility state.
When enabling one of these panels there is a huge spike on the CPU and many mono heap allocations. When enabled, our in-game store (simply sprites, buttons and text labels) causes a 1 to 2 megabyte mono heap allocation to occur. Our code doesn't allocate anything when this happens, it's just a gameobject.setactive operation. This isn't something that happens only once when the store is instantiated; it happens every time the user opens it.
In almost all of our panels the order of widgets never changes and no widgets are added at runtime to the prefab the UI was instantiated from. This seems like a common use case and something that should be fast.
I guess we can refactor the code to never disable these panels and just move them off camera when they shouldn't be visible but I agree with a previous poster... that solution seems like a hack.
When enabling one of these panels there is a huge spike on the CPU and many mono heap allocations. When enabled, our in-game store (simply sprites, buttons and text labels) causes a 1 to 2 megabyte mono heap allocation to occur. Our code doesn't allocate anything when this happens, it's just a gameobject.setactive operation. This isn't something that happens only once when the store is instantiated; it happens every time the user opens it.
In almost all of our panels the order of widgets never changes and no widgets are added at runtime to the prefab the UI was instantiated from. This seems like a common use case and something that should be fast.
I guess we can refactor the code to never disable these panels and just move them off camera when they shouldn't be visible but I agree with a previous poster... that solution seems like a hack.