I want to have a very large 3D grid. If I simply create a 3D array (i.e T[,,]
) I'm going to end up having a lot of unused (3D) positions in that grid, and due to memory usage, the grid will be far from how large I need it to be.
So my I idea is to make a "hollow" 3D grid of sub 3D grids (aka chunks) where each position contains a sub 3D grid. For chunks that are empty, the 3D array of that chunk does not exist in the parent 3D grid.
So I have a value of type : T[,,][,,]
Where the "top level" grid that contains the chunks is going to be a 3D array whose positions contain references to the chunks, or null if the chunk is empty.
My question is : how do I even initialize a value of type T[,,][,,]
? If I do new T[3,3,3][3,3,3]
for example, the compiler is yelling :
CS0178 Invalid rank specifier: expected ',' or ']'
Thank you.