Is There A Way To Save A Whole Prefab?

hi everyone,
i am creating a game where user will create some blocks ( lets say like minecraft ), next i want is that, when the user exits the game, all the blocks that he has created so far, combine into a single prefab, named " MYBLOCKS " and save that prefab to a harddisk, and when i load the game, the prefab itself loads(it contatins all the blocks, so all of them will also appear at the positions they were before)

is it possible somehow?

Prefabs as you know them on editor do not exist at runtime. What you are looking for is called serialization at runtime. There’re several solutions out there. You can try UnitySerializer

I think you just need dynamic parenting during runtime and save the transform values to achieve that effect… If I get what you want …


A “simple” solution is to create a save file containing informations about your objects, whatever they are. The file can be in xml if you want a tree structure, a database or a simple csv file, even a text file if you want.
An object contains a position, a rotation, a texture or / a light, and so on, and you’ll need to determine what information is need to instantiate them in order to get the same result previously saved.

The way you manage and structure these informations and files is up to you. You could eventually see if on the assets store there is a save file manager that’ll match your expectation.

Aside that, i strongly suggest that you look into file management with unity and the script language you are using.