SetFloatArray?

Hi guys,

For the life of me I can’t figure out how to implement the materal.SetFloatArray function.
In my simple example the code is as follows:

Vector2 scale = //some stuff
background.GetComponent<Renderer>().material.SetFloat("_ScaleX", scale.x);
background.GetComponent<Renderer>().material.SetFloat("_ScaleY", scale.y);
float[] scaleAsFloat = { scale.x, scale.y };
background.GetComponent<Renderer>().material.SetFloatArray("_Scale", scaleAsFloat);   

And although the single float vars work, the array doesn’t even though they should have the same values.

This is how I’ve declared in them shader:

float _ScaleX;
float _ScaleY;
float2 _Scale;

Any help you can give is much appreciated, thank you-

-Arman

float2, float3, float4 is not an array.
It is Vector2, Vector3, Vector4 type in Unity C# Math.

And you should use SetVector.

Unity only has SetVector for Vector4 type.