I’m trying to use a multidimensional array of structs in C#. After some time I have managed to write a single row array without fixed length. The code is as follows:
public GameObject block;
public GameObject emptySpace;
public struct cell {
public int cellRotation;
public GameObject cellBlock;
public cell(int r, GameObject b){
cellRotation = r;
cellBlock = b;
}
}
void Start () {
cell[] map = {
new cell(90, block), new cell(180, emptySpace), new cell(270, block)
};
}
I can access the structs’ properties easily by doing something like map[0].cellRotation
My question is, how can I define a new multidimensional array of structs of fixed length (say [2,3]) and how could I access it later on? Every single thing I’ve tried returns an error.
Thanks