Performance spike when toggling UI #150
-
|
Hey! I'm doing an inventory like Terraria which can open/close with a button. I've a GridView which handles 40 ItemSlot. Each of those ItemSlots is an ItemView. The thing is, everytime I close or open the inventory, Nova seems to take 20ms to activate/deactivate UIBlocks. All I am doing is call SetActive on the gameobject with the GridView. Am I doing something wrong? Is there a way to "hide" my inventory instead of activating/deactivating it (like the CanvasGroup in Unity)? I've attached a screen of my profiler when I'm toggling the UI. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
|
The first thing that stands out in the screenshot here is Beyond that, if Burst is disabled or if you're using the free trial version of Nova, which doesn't support Burst compilation, then that will also negatively impact performance. If you're using the full version of Nova, can you verify |
Beta Was this translation helpful? Give feedback.
-
|
I'm running into a pretty similar problem in my current project, but the outlined solution and other tips from @adgray1 don't fit my use case and I've been unable to come up with a good workaround here.... I'm curious if there's something I'm missing or if anything else has been added in the time since this question was asked. My issue is a little different, in that I'm trying to display a bunch of "balloons" over a game world... more akin to something like an RTS game with floating health bars, except that mine are comprised of ~40 different elements each, and I'm sometimes trying to render ~30-50 of these at once. Nova seems to be able to handle rendering them well enough, but when zooming or panning quickly, I'm hitting issues with this same type of show/hide problem. My initial strategy was to pool/recycle them as the user pans, and As outlined in this post, this amount of time for my amount of complexity isn't outlandish, so I've been trying other things... Mainly, I've tried moving them "off screen" instead of deactivating them, and while this avoids the massive spikes, I get stuck with this While this isn't the worst thing that Nova alone is taking ~4.5ms per frame, it seems silly to keep paying the cost of "every balloon I might ever need to show simultaneously ever" every single frame - even when I'm at a point where I only need a handful and the majority of them aren't even being rendered. In my versions where I deactivate them, these same Nova calls drop below 0.5ms. Is there some way I can "remove" them from this process? I've tried things like shrinking, masking, spreading them over different Z indices, but can't find anything that will reduce the runtime of this job.... I know and/or don't care if they overlap, yet I can't find any way to indicate this or short-circuit this to Nova. In that job I see stuff about Do I'm shocked there's no "don't render this thing" in Nova anywhere. It's a pretty basic and universally useful tool for a UI toolkit, and you guys have lots of features here. I understand Unity heavily leans on |
Beta Was this translation helpful? Give feedback.


Another optimization that could be made is ensuring your scripting backend is set to IL2CPP, rather than Mono, which you can change under
Edit -> Project Settings -> Player -> Other Settings -> Scripting Backend. IL2CPP will incur (typically) longer build times but better (typically) runtime performance.However, given that in-editor and runtime performance can vary widely between devices/hardware, 1.5ms doesn't sound far off from what we'd expect here. Some work is done for each UIBlock whenever it's enabled/disabled, either directly or because an ancestor was enabled/disabled, so that 1.5ms is actually a measurement of 161 object activations/deactivations (40 * 4 = 160 and then +1 for t…