Transform array help

My original post was closed before I could ask this so I am creating a new one.

I tried using several of the suggestions and am having issues. Any insight in to what I am doing wrong would be greatly appreciated.

I tried using:

var _targets : Transform;

But when I tried to drag and drop my corner game objects on to the elements in the inspector it will not take them. In other words I have the AI script on my enemy game object prefab. It has the AI script on it which has the variable _targets. I adjust the target size to 4. Then try to drag and drop the corner gameobjects on it.

How do I drag and drop the transform of a game object on to this in the inspector?

I also tried to do this manually in the script. I tried using.

var balls : ArrayList;

function Start()
	balls = new ArrayList();

function Update()
 	cornerOne= GameObject.FindWithTag ("corner1");
	cornerTwo= GameObject.FindWithTag ("corner2");
	cornerThree= GameObject.FindWithTag ("corner3");
	cornerFour= GameObject.FindWithTag ("corner4");
	corner1 = cornerOne.transform;
	corner2 = cornerTwo.transform;
	corner3 = cornerThree.transform;
	corner4 = cornerFour.transform;

However when I try to print whats in my array called balls. It just says “System.Collections.ArrayList”. It does not list any of the transforms I added to the array.

I am sure I have the context wrong but I am at a loss for where I am going wrong…

Assuming you know the size ahead of time the size will be 4, you can do:

private var balls : Transform[];
function Start() {
    balls = new Transform[4];
function Update() {
    balls[0] = GameObject.FindWithTag ("corner1").transform;
    balls[1] = GameObject.FindWithTag ("corner2").transform;
    balls[2] = GameObject.FindWithTag ("corner3").transform;
    balls[3] = GameObject.FindWithTag ("corner4").transform;

If the number of entries is variable, consider using a List (Generic), not an ArrayList.

Reference on array types: