Add Object to list error (JS).

hi, I am having an error to do with raycasting and adding the object to a list. Here is what I tried:

#pragma strict

var List_1 : Array;
var Object2 : GameObject;

function Start () {
}

function Update () {
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
	var hit : RaycastHit;
	if (Physics.Raycast (ray, hit, Mathf.Infinity)) {
		if(Input.GetMouseButtonDown(0)){
			print(hit.collider.gameObject);
			Object2 = hit.collider.gameObject;
			List_1.Add(Object2);
		     	for(var test in List_1)
    			{
    				Debug.Log(test);
    			}
    		}
		}
}

And the error I am getting is this:

35409-script_error.png

can someone please help, this is really confusing.

Never use the JS Array class; use a generic List instead. You need to initialize the list, usually in Awake or Start.