Set shader property from script and affect all materials

Hi,

I have a world curvature shader that has 2 float values to affect the amount of curve in the horizontal and vertical axes. All of the objects in my scene have materials based on this shader, but each one has a different material.

The curve floats need to be the same across every material to ensure they all bend in the same manner. I want to modify the value of the curve at runtime to create the effect of a meandering tunnel but it feels very inefficient to iterate through each material every frame and change the horizontal and vertical curve amounts.

As they all use the same shader, is there a way to modify these values at a shader level so that they affect all materials that use this shader (I’m pretty new to shaders to this may be a fundamental misunderstanding of how they work), or is there some other more efficient method of changing these properties on the materials.

In case it matters, I’m using URP.
Thanks
Mick

Have you checked Shader.SetGlobalFloat or other SetGlobal* commands?

See documentation:

I hadn’t (you don’t know what you don’t know), but will certainly have a look now. Thanks!