How to set array length in unity USING C#

Hey I need to set an array hidden in the editor (Ray) to match the length of another array (Transform).

I have searched some forums and I can’t seem to find out how to do this in C#. I need to use C# because this script is communicating with other C# scripts. Please help!

Transform[] Array1;
Ray[] Array2;
void Start() {
Array1.Length = Array2.Length; }

The sooner the better because I need this code to work soon! Thanks Unity Community!

-Forehead

2 Answers

2

Array1 = new Transform[Array2.Length];

Hey man, worked like a charm! Thanks for quick response now my game is going smooth again!

Thanks Man, thanks a lot.

Thanks Man, thanks a lot.