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

Question Building game takes ages

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

  1. ZingZangGames

    ZingZangGames

    Joined:
    Dec 11, 2020
    Posts:
    72
    upload_2022-9-27_17-48-39.png

    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..)