In Unity, in a Shader Graph, there is a dropdown to add params as seen in the attached image. Nowhere here is there an option that lets you create arrays, which is a very basic feature of any shader language. I see there is an option to pass in a Texture, and this can be used as a hacky workaround, but using a texture as an array has huge drawbacks:
- the complexity involved in having to deal with precision, texture widths/heights, converting array indices into a 2d uv index, worrying about the ranges ofthe uv and the texture, and other pointless complexity burdens.
- a Texture2D inherently is just going to be an array of vector4s, but maybe the shape of your data awkwardly fits into a vector4 for whatever reason.
- the readability is trash. It’s confusing to everybody that you are using a full texture just to store some floats.
- reuploading a texture every frame to the GPU has more overhead than simply uploading a float array
I need to simply have a float array. Again, in every shading language this would be trivial. I come from a GLSL and WGSL background where creating an array buffer of floats is as simple as creating a single float buffer. It would frankly be shocking and absurd if Unity could not do this.
So how do you do it?

