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.

Question Build stutters on new effects - how to force shaders (pre)compilation?

Discussion in 'General Graphics' started by Lad-Ty, Aug 10, 2023.

  1. Lad-Ty

    Lad-Ty

    Joined:
    May 7, 2013
    Posts:
    53
    Hi, we're nearing a release of our game. We work with HDRP if relevant, using shaders from shadergraph and various VFXs+shaders for those etc.

    We are dealing with a huge issue though, with Steam Deck being the main concern rn (is somewhat less of an issue on PCs it seems, but probably depends on PC)... we are not doing a Linux build for the Deck btw (because of early access = there will be a lot of updating and it would be a huge overhead for us, and the Windows build runs perfectly fine otherwise there).

    The game itself runs great once you've been running it for a while. But when launching it for the first time, every time there's a new explosion, new projectile, new creature, anything, the game freezes for a very uncomfortable amount of time. It makes a horrendous first impression after just starting the game, which as we know is the most important one.

    Because of the nature of these stutters (they only appear on the first new effect introduced etc after installing the game, consecutive launches are smooth), it seems the issue must be shader-compile related.

    How can we fix and prevent this? Even if it was at a cost of a big one-time freeze on a loading screen, where I'd call some PrecompileEverything(); but at least afterwards the game would run smoothly?
     
  2. c0d3_m0nk3y

    c0d3_m0nk3y

    Joined:
    Oct 21, 2021
    Posts:
    580
  3. Lad-Ty

    Lad-Ty

    Joined:
    May 7, 2013
    Posts:
    53
    Thank you, I've tried searching but didn't find this, cool, thanks! <3

    ( and also, oh god, I did NOT want to see that... hmm was hoping it would be somewhat more sophisticated/customizable what and when (and in parallel of course) :-| wtf this sucks )
     
    Last edited: Aug 10, 2023
    c0d3_m0nk3y likes this.