Search Unity

Feedback Unity and processor saturation / Processor affinity

Discussion in 'Editor & General Support' started by fherbst, Jul 13, 2020.

  1. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    I have a question about CPU affinity while building & compiling shaders.
    Unity got better and better over the last years to fully saturate all cores (which is great!), but in 2020.2 this has reached the point where the whole machine becomes unusable (especially during Shader compilation).

    I tend to do a lot of work while Unity does heavy stuff (e.g. building for Android might take 1-2 hours in some cases), so I'd love to set the affinity of Unity and all child processes so it uses N-1 processors instead of all of them even if that means build time goes up.

    (setting affinity in Task Manager is only "per spawned process", so each new ShaderCompiler.exe has it reset - seems they're not spawned by Unity.exe)

    So questions here would be:
    • how can I limit Unity to use N-1 cores permanently
    • how can I make sure that all UnityShaderCompiler.exe etc have the same limits?
    If that's not possible, please consider this a feature request :)