what is wrong with my array code?

var customer:GameObject;
var maxCustomerNumber:int;
private var customerArray:Array;

function Start()
{
	maxCustomer = new Array(maxCustomerNumber); 
}

function Update () 
{
	for(var i=0;i<maxCustomerNumber;i++)
	{
		if(customerArray[i] ==null)
		{
			customerArray[i] = Instantiate(customer,transform.position,transform.rotation);
		}
		
	}
}

i always get this error "object reference is not set to an instance of an object "

on this line

if(customerArray[i] ==null)

and after that i can’t click anything on unity (i cant even close an error window) and force me to restart unity .

anyone pls help :frowning:

Well, customer array is not instantiated.
I see you instantiate maxCustomer in Start instead of customerArray.

silly me i didnt see that

thx to show me my mistake :smile: cheers