- Home /
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
Answer by MaxGuernseyIII · Apr 17, 2018 at 10:25 PM
Array1 = new Transform[Array2.Length];
Hey man, worked like a charm! Thanks for quick response now my game is going smooth again!
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
[C#] Physics.Raycast returns an array and can't access the length 2 Answers
C# Adding to an Array 1 Answer
Need a hand using array.Length in a C# editor script 1 Answer