Instancing in WebGL builds on Windows causes several second lag spikes

  • updated

As discussed on the Unity forums in the thread Webgl performance and getProgramParameter, shader instancing is not well supported in WebGL builds running in browsers on Windows.

I'm currently using fairly few Polyline components, configured like so:

Polyline properties drawer in the Unity editorPolyline properties

This causes significant lag spikes (several seconds) on Windows WebGL, especially early (but not immediately and not exclusively) after the build has started playing.

To remove the lag spikes, I wrapped line 121 of the ShaderBuilder in #if !UNITY_WEBGL, and regenerated the shaders through the Shapes settings window.

Until instancing works better on browsers, an "enable instancing" checkbox or similar would be preferable to editing Shapes' code directly for WebGL builds, I think~

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline: