Array in JS NOT Working with Components?!

I have a Javascript, which is very simple. I get ONE Error that i normally shouldn’t get, because i did it like everyone else.

var = Component;

(This is not working, I’ll get an error. But if i use

var = Component;

Then it works?!

I really need help, thanks

You really should post your actual code and your actual error you get. Your both lines don’t make any sense and won’t compile. “var” is a keyword to declare a variable in UnityScript. It must be followed by a variable name. Next thing is you use the “equals” (=) operator which is used for assignments. However Component[] and Component are Types and not values which could be assigned to a variable.

You might wanted to specify the variable type, but that’s done with a colon (:slight_smile:

var myVariableName : Component[];

See reference for how to declare array Array Declaration in Javascript