Saving lots of objects (Only answer in JavaScript)

I know this is a hard one so a big thanks in advance. So I have this game called borda and the world is made of many many cubes that need to be saved. I can’t figure out how to save it all with out the game crashing. So if you guys can help me have unity save and load all this stuff I would be very thankfull.

heres some pics

alt textalt text

It’s not workable to have separate GameObjects for each block. Look up any of the various topics about Unity and Minecraft clones for ideas and code. Essentially, you create mesh chunks using the Mesh class, from an array which represents the world. You can save the array using System.IO classes. e.g., if you use a byte to represent each block, then you could simply use System.IO.File.SaveAllBytes to save the array directly (and ReadAllBytes to load it).