J
J
Jeywin2022-02-26 20:59:46
C++ / C#
Jeywin, 2022-02-26 20:59:46

How to store a 2D array with generated prefabs in Unity C#?

Let me say right off the bat that I am new to all of this. I have some room generation from prefabs that are saved in private Room[,] spawnedRooms;(on prefabs script "Room" that randomizes walls). A two-dimensional array is needed in order to check already occupied areas on the grid, so as not to spawn rooms on top of each other again. If anything, prefabs are made up of many objects. How can I save all these "chunks" with their random walls, so that they can be loaded later on when the game starts, and also to load and unload chunks around the player in the future (for optimization)?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question