I have a public class (simplified):
public class opening
{
public face side;
public int start;
public int length;
public opening(){}
}
I want an array of opening
in another class
opening[] openings = new opening[4];
but when I try to assign a value to it, for instance:
this.openings[2].side = side;
I get "Object reference not set to an instance of an object" I can work around it using:
this.openings[2] = new opening();
this.openings[2].side = side;
but calling new opening();
for each element of the array feels odd, isn't there an easy way to instantiate every element of the array when creating it?