I am working on a game and I am using an array of Chunks to store loaded Chunks. Currently, I am working on terrain generation when the player spawns in. Is there any way possible that I can create a new Chunk in the chunk array whenever I see fitting. Long story short, when the player walks to a region where a chunk is not generated, I want to initialize a new value in the chunk array WITHOUT having to initialize that Chunk in the beginning of the class.
chunks = new Chunk[chunkCounter];
chunks[chunkCounter] = new Chunk();
chunkCounter++;
Every time a new Chunk needs to be generated I need to do something like this where I create a new Chunk in the array without the size of the array being previously stated.
Thanks in advance.