Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Resolved (Case 1278110) Can't build specific game with 8GB RAM with versions after Unity 2020 a19 just saying

Discussion in '2020.2 Beta' started by unitedone3D, Sep 15, 2020.

  1. unitedone3D

    unitedone3D

    Joined:
    Jul 29, 2017
    Posts:
    160
    Hi there! I have downloaded Unity 2020s..all alphas and today, the new beta 2020.2; I have encountered a problem with building a game. In Unity 2020 alpha, alpha 1 to 19 I am able to build correctly/to completion. But after that, there are new changes post-alpha.19 that make the engine quite different. I mean I have a PC with 8 GB RAM so this is the limit to why it would not build correctly in later Unity version (after alpha 19).
    The test I did was simple, I downloaded the asset : ''Creator Kit: FPS 3D asset (the FPS game by Unity)'',
    https://assetstore.unity.com/packages/templates/tutorials/creator-kit-fps-149310

    and tried to build it in Each version I downloaded (I left the Project Settings as they are 'default' when you download Unity). I could not build it anymore post-19. What happens is that the build starts and everything is going well...it compiles everything and then it arrives at 'shaders', compiling 'shader variants'...and then it hangs there; it stops at 'shadows shader' (it seems light shadow map shader is too heavy); what happens is that Windows freezes from lacking memory; I checked in the Task Manager and it Rises exponentially the instant it arrives at that shader compiling; then it reaches like +5GB RAM and then it reaches limit/freezes Windows because too much RAM requirement (have only 8 GB; maybe with 16 it would now work?). I tried to build another 'empty scene' and it worked correctly... Thus, I cannot compile *this Asset in Unity 2020.2 beta or any other previous ones, down to alpha 19. It means it is a 'shader/variant compiling eating RAM problem'. IT's strange because I can build that Exact same Creator Kit FPS asset (up to/in) Alpha 19 no problem - with only 8GB RAM (like OS/Unity are capable of 'working it out' with 8 GB RAM in alpha 19).....not after that version. In those previous versions, the compiling continues correctly and it compiled every shader variant correctly (it does not run 'out of memory/Freeze Windows/Unity frozen'). I tried the game and it works perfectly. I will stick will alpha 19 (still I read now that Unity 2020.2 beta has peformance regression??), so I guess alpha 19, it is.
    (unless maybe if I upgrade to 16GB RAM).

    Just a 2 cents. Thanks for reading.

    PS: If you have 8GB RAM, download Creator Kit: FPS and Unity 2020.2 beta, and try building it, it probably won't work (will freeze/lack of memory when shader variant compilation happens).

    PPS: I dabbed in the Project Settings and Jobs -> tried with regular compiler, I tried with 'Burst' compiler or 'graphics job' or with 'shader stripping all'...makes no difference build hangs at shader compiling due to excessive RAM rise/load. Could this mean a shader (variant) problem...though it builds perfectly in alpha 19; go figure. My take is that the 'asset pipeline 1/2' thing has problems or the compiler Itself has problem with compiling such shader (maybe the compiler is much different after alpha 19 and why it eats all RAM when shader variants compilation happens). I also tried to make a NewShaderVariants file (in Projects Settings > Graphics) in shaders slot...no difference, build/unity freezes due to lack of RAM. I can't even terminate Unity (because OS is frozen, I waited 3 hours and it was still frozen (RAM lacking causes that to OS)).

    PPPS: I'm just giving this as help for anyone (with 8GB RAM) to use Unity 2020.2 beta, you may encounter this building problem. I won't go up of alpha 19 (since apparently Unity 2020.2 beta saw performance regression for some people; despite I looked forward to the improvements, regressions in fps performance; can't/I prefer a stable version with enough fps/so far alpha 19 is the most stable one (in my case) and only 'last/most recent' one I can build a large game with, with 8GBram)). So think of this I just a little problem you could look at to help others (but I won't do back and forth exchange on this problem/it's done, I'm stying with alpha 19). If performance regression and that build problem are fixed (when with only 8GB RAM to build) I might upgrade then.

    PPPPS: I still wanted to share this, I decided to share it/I thought.....I'll just stick with a19 and not report this bug like problem; but decided to because it might help someone who Really wants to obtain Unity 2020.2 beta (but faces same problem).
     
    Andresmonte and valarnur like this.
  2. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    Hi @unitedone3D,

    Could you please submit a bug report for this issue with the instructions you provided above attached?
     
  3. unitedone3D

    unitedone3D

    Joined:
    Jul 29, 2017
    Posts:
    160
    Dear LeonhardP, thank you, bug report was sent.
     
    LeonhardP likes this.
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    Can you please post the bug-report Case number (number only, not the link) here for Unity staff to pick up?
     
    LeonhardP likes this.
  5. unitedone3D

    unitedone3D

    Joined:
    Jul 29, 2017
    Posts:
    160
    Dear QA Jesus, thank you, case 1278110.
     
    JoNax97, LeonhardP and Peter77 like this.
  6. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    @unitedone3D Hi! 2020.2 has Caching preprocessor turned on by default. It eats more RAM, but does things faster :)
    You can turn it off (Project settings -> Editor settings -> Caching preprocessor checkbox) while I try to limit the caching when there's not much RAM in the system.
     
  7. unitedone3D

    unitedone3D

    Joined:
    Jul 29, 2017
    Posts:
    160
    Dear Aleksandr, thank you!, this works/Fixed.

    The build goes on correctly (compiling all shaders) and there is no hanging/freezing (memory spike); thus, the culprit, preprocessor/shader caching is too costly on low RAM memory computer. Anyone having this problem, it is preprocessor/shader caching the problem; turn it off as Aleksandr said and it will now work on 8GB RAM (or possibly less, at most points Unity compiling shaders (with this particular asset) does not go above 2GB RAM (in Task Manager, I had it in the background and was constantly checking it while Unity compiled); so, probably with 4GB RAM it will work too; but on 2GB RAM it may end up too tight/may freeze because reaching near-2GB RAM use; thus, 4GB RAM or 3GB RAM I think are bare minimum).
     
    Last edited: Sep 24, 2020
  8. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    Which Unity version are you on right now? It left experimental state in 2020.2.0a13.
     
  9. unitedone3D

    unitedone3D

    Joined:
    Jul 29, 2017
    Posts:
    160
    Re You are right, I apologize, it is not 'Experimental' anymore in 2020.2.0b2.3094 (I confused 2020.1.a19 projects settings with 2020.2.b2; removed the 'experimental' bit above).

    PS: Just a suggestion for the Unity version, a (note*) should be besides this setting in Projects Settings - ''Will not work on Low RAM machine''. It is not experimental anymore, but it still does not work will low RAM (thus it not useable for low RAM), a small notice there would help for anyone stuck with the problem (so they would go in their projects settings and turn if off knowing it problably is the cause of RAM excess/freezing use during shader compiling - because ''Will not work on Low RAM machine'', clear message).
     
    Last edited: Sep 24, 2020
  10. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    I'll try to reduce its RAM usage first :)
     
    valarnur and Peter77 like this.
  11. valarnur

    valarnur

    Joined:
    Apr 7, 2019
    Posts:
    440
    For 2020.1 as well ?
     
  12. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    Yes, but for 2020.2 first.
     
  13. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    OK, a short update: I managed to cut down the peak memory usage by about 2x (1.11GB -> 533MB on my machine per UnityShaderCompiler process).
    The fix also speeds up shader compilation a bit (the project in the bug report went down from 445 seconds total build time to 414 seconds).
    I'll post here when the fix is available for 2020.2 and 2020.1.
     
  14. Cerberus_team

    Cerberus_team

    Joined:
    Apr 9, 2014
    Posts:
    43
    I' am using 2020.2.2f1 and i can't build the project, it gets stuck on shader variants.
    I uncheck caching preprocessor but it still not working.

    I am using Intel(R) Core(TM) i7-4710HQ CPU @ 2.50GHz with 12.0 GB of RAM
     
  15. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    Hi! It took a bit longer than I initially thought it would, but the fix is there in:
    2020.1.11f1+, 2020.2.0b9+, 2021.1.0a2+

    @Cerberus_team this means it's something different. What do you mean by "it gets stuck on shader variants"? Does it compile variants, but slowly? Or does it stop completely?
     
  16. Cerberus_team

    Cerberus_team

    Joined:
    Apr 9, 2014
    Posts:
    43
    It gets stuck, i left it overnight and this morning it was still compiling shader variants.

    And the task manager show unity as not responding.
     
  17. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    It usually shows something like "Compiling shader <ShaderName> variant X out of Y" - does X change over time?
     
  18. Cerberus_team

    Cerberus_team

    Joined:
    Apr 9, 2014
    Posts:
    43
    No it does change over time.

    Screenshot.png

    It got stuck on a Frameplay shader yesterday, but it could be any shader.
     
  19. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    This looks like a different issue. Can you please submit a bug report?
     
  20. Cerberus_team

    Cerberus_team

    Joined:
    Apr 9, 2014
    Posts:
    43
    It's a 10gig project, and i' am not sure about the steps to reproduce since it builds correctly on new projects.
     
  21. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    Editor log shows some compilation stats - how long it took to compile a specific shader. Is there anything odd in these logs? You can check the log right when it gets stuck as well.
    You said it happens on different shaders. Do all those shaders have many variants?
     
  22. Cerberus_team

    Cerberus_team

    Joined:
    Apr 9, 2014
    Posts:
    43
    The ones we use have around 70 variants, those from plugins have way more. Last time it was stuck on PostProcess shaders from unity.
    Normally it always get stuck near the end, when there is 10 or less.
     
  23. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    There's a sync point there - when it finishes compiling the variants for a single shader it writes out the data. This shouldn't take a lot of time, but for large shaders with many variants it can take some minutes (but not hours).
     
  24. oTaijjo

    oTaijjo

    Joined:
    Nov 3, 2019
    Posts:
    30
    Hi, I'm also noticing a lot of memory being used when building with Unity 2022.1.20f1.
    I also cannot find any checkbox for disabling caching, as was suggested earlier, neither via "Project settings -> Editor settings -> Caching preprocessor checkbox", nor a Shader's inspector.

    Is enabling/disabling the caching preprocessor available in 2022.1.20?
     
  25. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    3,026
    No. It's the only option nowadays.
    The memory you see is likely in taken by the Editor itself, not the compiler processes.