Array of class that has arrays NullReferenceException error

Hi, I’m getting a NullReferenceException at

I can get it to work if I change it to var easyP : Pattern; and then obviously removing the array reference/setup.
Any help would be much appreciated, Thanks

var easyP : Pattern[];
var mediumP : Pattern[];
var hardP : Pattern[];
var xHardP : Pattern[];


class Pattern
{
	var elePattern : float[];
	var eleGap : float[];
	var eleSpeed : float[];
	var isDelayed : boolean;
	var delay : float[];	
}

function Start()
{
	easyP = new Pattern[5];
	easyP[0].elePattern = new float[5];
	easyP[0].eleGap = new float[4];
	easyP[0].eleSpeed = new float [5];
	
	
	easyP[0].elePattern[0] = 2.6;
	//print(easyP[0].elePattern[0]);
	easyP[0].elePattern[1] = 2.6;
	easyP[0].elePattern[2] = 2.6;
	easyP[0].elePattern[3] = 2.6;
	easyP[0].elePattern[4] = 2.6;
	
	easyP[0].eleGap[0] = 2.5;
	easyP[0].eleGap[1] = 2.5;
	easyP[0].eleGap[2] = 2.5;
	easyP[0].eleGap[3] = 2.5;
	
	easyP[0].eleSpeed[0] = 2.5;
	easyP[0].eleSpeed[1] = 1.5;
	easyP[0].eleSpeed[2] = 3;
	easyP[0].eleSpeed[3] = 1;
	easyP[0].eleSpeed[4] = 1.8;
	
	easyP[0].isDelayed = false;
	
	
}

Since it’s class (not a struct), there are no default values, so you have to initialize the entries.

   easyP = new Pattern[5]; 
   easyP[0] = new Pattern();

Probably also want to make a constructor for it.

–Eric

thanks very much