an array of a class, in another array of a class

Hi,

I am trying to access an array of a class, in another array of a class. However the last 2 lines don’t work, and I don’t know how to do it…

class pattern{
var width: float;
var number : float;
var Asteroids : asteroid;
}

public class asteroid{
	var position : Vector3;
	var rotation : Vector3;
	var scale : Vector3;
}

var patternList : pattern[];

function CreatePattern(){
var patternList = new pattern[50];
patternList[0] = new pattern();

var patternList[0].Asteroid = new asteroid[10];
patternList[0].Asteroid[0] = new asteroid();

Remove the ‘var’ on line 13.

Also note that you’ve declared patternList twice, which may result in unexpected behaviour (the one outside the function will stay null)