Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Taking forever to edit a shader in 2020 compared to 2018

Discussion in 'General Graphics' started by nyanpath, Oct 18, 2020.

  1. nyanpath

    nyanpath

    Joined:
    Feb 9, 2018
    Posts:
    77
    Greetings,
    I have a custom toon shader I haven't worked on for two years that I decided to tweak a little again for my project. Since I started on it I have upgraded from Unity 2018 to Unity 2020. What I noticed is that it now takes over a minute for Unity to implement the edits I do to the shader, compared to maybe a second or two before. I used to do a lot of shader editing simply because it was the fastest way to script anything for Unity, but now it is the complete opposite.

    How and why?
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    Hi!
    Can you please send a bug report?
    I've seen only a single occurrence of this problem, and didn't get a bug report yet.
     
  3. nyanpath

    nyanpath

    Joined:
    Feb 9, 2018
    Posts:
    77
    I can send a bug report once I am home. I am going to try in 2019.4 now.
     
    aleksandrk likes this.
  4. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    Thank you!
     
  5. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,291
    I found a possible solution, posting it here for anyone that may have the same issue.

    The time was reduced from 1.5 minute to less than 2 seconds !!

    I disabled the following option:
    Project Settings - Editor - Shader Compilation - Asyncronous Shader Compilation
     
  6. nyanpath

    nyanpath

    Joined:
    Feb 9, 2018
    Posts:
    77
    I tried it in Unity 2019.4, same as 2020. Still slow here...
     
  7. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,291
    Which 2019.4 version ? I used 2019.4.5f1 and urp and this change fixed the issue, but can be anything i suppose.
     
  8. nyanpath

    nyanpath

    Joined:
    Feb 9, 2018
    Posts:
    77
    2019.4.8f1 using default rendering settings (I haven't edited anything).
     
  9. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,291
    the
    The default uses the asynchronous compilation, that is why the problem appears, so must remove the default in this case
     
  10. bdeschryver

    bdeschryver

    Joined:
    Jun 13, 2013
    Posts:
    93
    Dear,
    I am running into this issue as well. My project in URP (Unity 2020.2.7) holds a large number of sifferent shaders, and trying to update a prefab to change a shader takes a few minutes... Totally unusable.
    I tried disabling the asynchronous shader compilation, but that does not seem to help.
    I also haven't seen replies in forums thread that this was confirmed to be the cause.
    Anybody can confirm officially ?
    Anybody has an idea on what else would cause that extensively long time ?

    Thank you,
     
    Last edited: Mar 30, 2021
  11. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,291
    what pipeline is used ?
     
  12. bdeschryver

    bdeschryver

    Joined:
    Jun 13, 2013
    Posts:
    93
    initial post updated, sorry I forgot to mention URP
     
  13. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,291
    Generally from what i have seen pipeline shaders are way slower to compile too than standard pipeline

    I get this feeling as Unity and pipelines progress everything is getting extremely more demanding in PC to develop a game and seems very unoptimized.
     
  14. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    @bdeschryver how large is your "Library/ShaderCache.db"?
     
  15. GeroNL

    GeroNL

    Joined:
    Dec 25, 2020
    Posts:
    3
    I got same issue, taking long time to change shader.

    Large of ShaderCache.db in my project is 9GB more or less.

    Nb:
    - using URP pipeline
    - Unity 2020.2.5f1
     
  16. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    @GeroNL the issue has been fixed in 2020.3.0f2
     
    richardkettlewell likes this.
  17. GeroNL

    GeroNL

    Joined:
    Dec 25, 2020
    Posts:
    3
    ok, thanks aleksandrk

    but if someone still not want to do it(update to that version), and not much use variant of shading in the project or maybe go new project and got some this issue(cause maybe you copy all file from last project) you can delete ShaderCache.db and ShaderCache(Folder), but if in your project use many variant of shader, it will take longer in the time you using it.
     
    Last edited: Aug 24, 2021
  18. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    Just killing ShaderCache.db would be enough.
     
  19. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,291
    Hi, is this related to the issue where shaders can take 10-20x longer to compile when the async compilation mode is enabled in the settings ?
     
  20. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    No idea. I haven't yet seen a reproducible bug report on the async issue.