Modifying shader property at runtime have no effect

Hi,

in our application we dynamically modify some property of shader on the material of gameobject in the scene, this work fine in Windows standalone build and in unity editor, but in Vision OS it is ignored. We tried with shader graph and standard universal renderpipeline shader and none work.

So is it a limitation right now? Or there’s something I can do to make it work?

Can you provide more info? What kind of renderer is it? How are you modifying its properties? Are you just changing the material, shader, renderer’s property block?

1 Like

This should work if you are setting the properties in script using the methods in Material such as Material.SetColor. However, if you are attempting to set the material properties via animation, there’s a known issue where those properties won’t result in the material being marked dirty for transfer over PolySpatial, and the workaround is to set some other property via script to a unique value to force the material to retransfer.

It’s also worth noting that properties must be “exposed” in the shader graph in order to be set.

If you’re setting exposed properties via script and they don’t transfer, please submit a bug report with a repro case and let us know the incident number (IN-#####) so that we can look into it.

We use the URP render pipeline.
We do a SetFloat, on a property that is exposed (it work on a windows standalone build)
Is it possible that it is a missing shader variant?

In visionOS MR, we don’t generate shader variants; we simply translate shader graphs into MaterialX representations for use in RealityKit’s ShaderGraphMaterial (or, for certain standard shaders like URP/Lit, into PhysicallyBasedMaterial or UnlitMaterial). As I said, a repro case would help us know what might be going wrong. Otherwise, we don’t have enough information.