0
\$\begingroup\$

The documentation for Material.SetFloatArray it states:

Sets a float array property on the material. If a float array property with the given name already exists, the old value is replaced.

If I set the same array on multiple shaders, is the float array shared among shaders like texture, or will every shader have its own copy of the array? (Which multiplies the amount of RAM needed by the amount of shader that use it.) If the array is not shared, then is there any way to set array in such a way that the array is shared between shaders?

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

The data is not shared when you use Material.Set*. This is unique to a single material instance.

It sounds like you're looking for Shader.SetGlobalFloatArray. This sets a float array that's accessible to all materials, not just a single instance of a particular material.

In general, if you want it to be used by just one material instance, use the Material version. If you want it to be global / accessible between different shaders and material instances, use the Shader version.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .