Slate Forums › Support › Slate editor is very CPU heavy?
anyone else finding that slate is quite CPU intensive? as soon as I open the slate cutscene editor window, my unity CPU usage spikes up to 10%+
when I close it, it goes back down to 0.5-1% again
the same thing also happens when just having a Cutscene component being inspected in the inspector
as soon as I click on a different gameobject, cpu goes back down to normal
This happens even on brand new, empty cutscene
Hello there,
I will check the code again to see if I can optimize the editor even more.
Thanks for letting me know!
Join us on Discord: https://discord.gg/97q2Rjh
Was there ever any insight into this?
To be specific about the concern, there are two main ways in which Slate will use what seems like an enormous amount of CPU resources for what it’s doing. This is very easy to see if you use the Profiler, profiling the editor, or even just looking in the Task Manager and noting the CPU usage. You’ll see performance issues either when 1) The Cutscene window is open, or 2) Just having the Cutscene selected (with the Inspector showing) results in huge CPU usage.
The simplest test case is to create a new scene. Close any Game Views or Scene Views you have open. In this state, the Unity editor sits at around maybe 1% of my CPU usage when Unity is focused. And pretty much 0% when Unity is minimized.
Now add an empty game object, and add a Cutscene to that game object. Open the cutscene. The CPU usage now goes up to a steady 30% usage. This does NOT go down if you minimize Unity.
Now close the Cutscene window, but keep the Cutscene gameobject selected in the inspector. CPU usage again goes up to about 30%, just having the cutscene selected in the Inspector, without even having the window open. Again, this CPU usage stays high even when Unity is minimized.
This CPU usage appears to have nothing to do with the complexity of the cutscene. Again, in this test case, the cutscene was empty. I even deleted all of the tracks, and still the CPU usage spikes.
I’m not sure if there’s some editor code that’s running every frame that should only be running once, or only run when something changes? But it’s definitely gotten to the point where I’m very careful to close the Slate window, and select something else in the editor, to avoid having my CPU times climb, unless I’m actively editing a cutscene. This isn’t the end of the world, but it would be nice if this turned out to be some simple thing.
Hello,
Are you using the latetest version 2.2.1 by any chance? I am asking because there were some editor performance improvements in that latest version.
Let me know. Thank you.
Join us on Discord: https://discord.gg/97q2Rjh
Are you using the latetest version 2.2.1 by any chance?
Yes, this is using 2.2.1. I’ve just tested it in the simplest way:
Profiling the editor with the Slate editor open, you’ll see that Slate is doing a lot of work every single frame that the window is open. It doesn’t matter how simple of complex the cutscene is, the CPU usage seems constant (and high) at all times if the cutscene window is open. Maybe there’s stuff that’s running every frame that should only be running when something changes? I don’t know.
For what it’s worth, I’ve seen similar issues with other Unity windows. For example, ProBuilder. I reported this some time ago, but they haven’t fixed it. https://forum.unity.com/threads/1386385-probuilder-window-using-a-bunch-of-cpu-just-sitting-there.1204204/#post-7714597
So, maybe this can’t be fixed, and it’s just a really unfortunate downside to making a Unity window, I’m not sure. I guess the question is why the editor repaints every frame if it’s not really supposed to?
On a related note, I just noticed that ProBuilder had an update last month which claimed “Significantly improved performance of “ProBuilder Window.””. I tried out the new version (5.2.0), and was happy to find that having the ProBuilder window open now no longer fully consumes a CPU. I have no idea whether they’ve moved to the new UI framework for this, or whether they had a more targetted fix to the issue of the window refreshing every frame. But, I figured I’d point it out in case it’s at all similar to the reason why Slate Cutscene editor uses so much CPU while idle.
Hello again and thank you for letting me know. I will do another “optimization pass” on the editor performance code for the next version to optimize it more. Thank you 🙂
Join us on Discord: https://discord.gg/97q2Rjh
FWIW, it kind of looks like it’s not something you can probably do much about, aside from completely rewriting your assets using UITK.
As I mentioned, ProBuilder used to exhibit similar behavior (full repaint every frame), until a very recent update. Well, in that update they moved from UGUI to UITK:
Asking around, it seems UGUI just has some issues with certain controls that force everything to repaint every frame, even when no data is changing. I wish I knew more than that, but I guess it’s mostly just an issue with the framework, not your approach/code.