This tutorial explains how to pass arrays to shaders in Unity. This feature has been present for a long time, but is mostly undocumented. Unity 5.4.0 Beta 1 will introduce a proper API to pass arrays to shaders; this technique however will work with any previous version.
- Step 1: The arrays
- Step 2: The shader
- Step 3: The C# code
- Step 4: A more general approach
- Conclusion & download
If you are using Unity 5.4+, please refer to the Arrays & Shaders in Unity 5.4+ tutorial.