Saving a GameObject

In my game , i have to instantiate a gameobject at player’s desired position , how could i save this gameobject and his position ?? Also , he has to spawn more than one object of the same kind (( therefor the names will overlap ))

OR

How could i save a scene that the player edit during runtime? =3

After reading more , i figured that i cant save scenes during runtime , therefor i need a new solution

I need to get a save of every gameobject in my scene , their Name and their position so i can load them back when i hit loadmap.

Anyone could point me the dirrection ? :>

Look into PlayerPrefs in the scripting manual. There’s some real good examples in the forum and in the wiki.:slight_smile:

i cant find any , their all talking about saving ints and strings , i want to save an gameobject , rly confused right now

You can’t save the GameObject itself, but you can save the various properties of it and rebuild it.

For example, you could store each of the transform.position.x/y/z values, then reassign them when you reload the object.

You can also make a custom Properties class for your scene and save it to an XML file with serialization