- Home /
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
How many cubes is many many cubes? And why on earth do you want an answer in Java?
it could be any amount of cubes cus the player can destroy them and stuff. I need it in java cus I dont know c# that much yet
I think you mean JavaScript then - Java is a different language entirely :) It's hard to define a structure to efficiently store "any amount" of data... and the description of your game is sounding horribly $$anonymous$$inecraft-y, in which case you're going about it the wrong way anyway - look up voxels rather than creating millions of cubes - your current approach is just not scalable.
Answer by Eric5h5 · Oct 14, 2013 at 12:13 AM
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).