Right now my shader has this
Properties {
_HolePosition0 ("HolePosition0", Vector) = (0, 0, 0, 0)
_HolePosition1 ("HolePosition1", Vector) = (0, 0, 0, 0)
_HolePosition2 ("HolePosition2", Vector) = (0, 0, 0, 0)
// ...
_HolePosition9 ("HolePosition9", Vector) = (0, 0, 0, 0)
}
Is there a way to set an array of vectors in my shader? Or should I continue to hardcode N holes as the maximum number of holes allowed?
I did something similar but ended up using matrices instead - e.g.
float4x4 _HolePositions;
You can set those in the material in the c# code using SetMatrix. I’m not sure if that would be much different from using vectors though. If you’re having a lot of different holes it might be easier to create a texture with the hole positions encoded into the colour data and then you can decode it within the shader. That might be a bit slow though if you need to change the hole positions all the time.