Whenever I build, including right now, I see all 8 cores ramp up to 100% cpu usage. Often i’m running mulitple processes, or even multiple editors on my machine. I’d love, for example, to say: hey this instance of unity, use cores 1-4, but don’t touch the rest. This other instance, use 5,6. So 7-8 is for everything else like windows.
At the very least, it’d be nice if I can force Unity editor to use only a single core. Sometimes I’m not in a hurry to build, but I don’t want that time to make my computer less convenient to use.
You can try using your task manager to limit the cores directly for the process.
Task Manager → Details Tab → Right Click on desired process → Set Affinity
The problem is that as far as I understand, that sets the affinity of unity.exe …but during the build, unity spawns a bunch of compiler process that run on other cores
if you set the process priority of the running unity.exe process to low, all unity spawned processes will inherit that low priority setting. This should help a lot and shouldnt affect the other use of your computer while building
Note: sometimes eg. for atlas baking or mobile texture import/processing low prio on the main unity process still causes totally sluggish general windows behavior, despite my 6/12 core machine. I guess this is mainly when the texture compressor uses some GPU acceleration
Thats the only case i ever do the affinity trick to keep one core explicitely away from unity
hmm, that didn’t seem to work…or maybe the reason cpus are all being used up has to do with some lower level stuff
anyway, i set it to use 1 cpu, and once i started building, it looked like all cores shot up to 100%
Setting affinity didn’t work?
Try also set low priority.
Also, remember that because you use less of CPU, your drive may be busy reading and writing. So doing something else, while project is building for example, may be affected by that too, or vice versa.
This will start unity, only using the first core. This applies to all spawned processes as well. Please note that the cores are labeled with 2^n where n is the core ID starting from 0, and the affinity argument is the sum of the core labels in Hex.
For example,
To make use of only the 3rd and 5th cores in your cpu
You would first calculate the required value as 2^2 + 2^4 = 4 + 16 = 20
Convert this to hex (base 16) which is 14
and use 14 as the argument for affinity
Of course it shoots up to 100% CPU usage - and thats a good thing. Running on low priority and using 100% cpu does not necessarily mean your input or other processes running on normal priority suffer lag or starving on cpu time…
Usually you shouldnt care wether your cpu total is at 100% or not while running some serious tasks like building as long as it runs that on low priority, the OS is responsible giving all your other tasks priority
But of course, if you still suffer from that , affinity mask would do the trick
I was reading this thread wondering if the problem isn’t CPU, but maxing out access to the disk, causing other applications waiting on the disk to appear unresponsive. The problem can be made worse if you’re maxing out your RAM at the same time, resulting in a lot of hitting the page file on the same maxed out drive.
My pretty decent desktop (i7/32GB/SSDs/1080GTX) seems unable to browse the web while Unity 2020 is baking lighting or compiling shaders.
I’m sure older versions weren’t this bad. Unless there’s something else on my machine that’s only recently started causing a problem. (Sometimes task manager shows ‘system interrupts’ taking up loads of CPU time)
I can happily browse away while baking with Bakery, though.
I have switched to PLM GPU baking now, but when I used PLM CPU I didn’t notice these slowdowns. Actually the computer happily let me surf and do other stuff while all 32 threads were working 100 procent. The windows scheduler makes this happen.
I’ve had absolutely none of these problems doing the same on my less powerful (Ryzen 3600, 1070) computer with otherwise equal specs. I’m thinking there must be more at play here.