Quick answer: The collection must contain the exact shader+keyword+passtype variants the game uses. Record them from a real play session, then call WarmUp() during a loading screen.
A game still hitches the first time each effect appears, even though a ShaderVariantCollection asset exists and WarmUp is called. The collection doesn’t contain the right variants.
Record Real Variants
Edit → Project Settings → Graphics → “Save to asset” under Shader Loading. Play through the game touching every effect, then save. This captures the actual variants used — guessing keyword combinations by hand always misses some.
Call WarmUp at the Right Time
[SerializeField] ShaderVariantCollection variants;
IEnumerator PreloadShaders()
{
variants.WarmUp(); // blocks; do it behind a loading screen
yield return null;
}
WarmUp compiles/uploads the variants synchronously — it’s a hitch itself. Hide it behind a loading screen, not mid-gameplay.
WarmUpProgressively
For large collections, WarmUpProgressively(count) spreads compilation across frames so the loading screen stays responsive.
Keep It Current
Add a new effect or shader keyword and the collection is out of date again. Re-record before each release, or automate variant collection in CI by running a playthrough.
Verifying
After WarmUp, trigger each effect for the first time — no compilation hitch. The Frame Debugger shows no “Create GPU Program” spikes during gameplay.
“Warm-up only helps if the collection holds the real variants. Record from a playthrough, warm up behind a loading screen.”
On consoles, shader hitches are a cert risk — treat the variant collection as a release artifact you regenerate every build.