Shader
Unity WebGL Safari Hang: The First-Draw Shader Stall
TL;DR — This is a war story about a Unity WebGL Safari hang: a game that ran beautifully on Chrome but froze for ~3 seconds on the first major animation event in iOS Safari. After a long detour through material instancing, shader keywords, animator transitions, and post-FX, the culprit was a single prefab nobody thought to warm up: an overlay spawned by an obscure event handler one frame before the animation started. Mid-game
Read more “Unity WebGL Safari Hang: The First-Draw Shader Stall”Instantiateof a prefab with a custom shader triggers Safari’swebglPrepareUniformLocationsBeforeFirstDrawon first render — synchronous, main-thread, ~3ms per uniform lookup, ~200 uniforms across a complex prefab = 2.8s stall. The fix is to render the prefab once during the splash so the cache is warm before gameplay needs it.