Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Building game takes ages

Discussion in 'Unity Hub' started by ZingZangGames, Sep 27, 2022.

  1. ZingZangGames


    Dec 11, 2020

    Hello there!

    I've had this problem for a long time now, but the build times keep getting longer. I noticed that each time I build the project, thousends (sometimes up to 500 million!!) of shader variants are compiled. And even when they're cached after one build, after some time they're regenerated (and that takes forever).

    With these unbelievable build times (up to 3 hours) it's impossible to implement multiplayer for our game.
    I tried following, neither worked..:

    - enabling GPU instancing on all materials
    - pre-generating shader variants (and clearing them) on ProjectSettings > Graphics
    - removed all unnecessary shaders from the always-include list
    - turned off prebake mesh in ProjectSettings > Player
    - some more tweaking with the graphic API's and other graphics-stuff

    After one build time, the variants are cached and build times go down to 1-2 minutes. But somehow, the cached variants get removed, and then the whole thing is compiled again.
    Why are so many (sometimes around 500 million) shader variants needed? And how can I fix this (we've tried all the points above)

    Thanks in advance! :)
    (Sorry if this isn't the right forum for this topic, but i couldn't find another one that'd fit with this thread..)