Saving maps

Hi All!
I’m finally coding my first real game.
I got a nice level editor working, which lets you pick different objects and place it around the map. Now I want to give the user the possibility to save its creations and maybe even send them to a server to share with other people. How is the correct way to approach this? I read about “PlayerPrefs”, and it seems easy enough but will I be able to send a PlayerPref to the server? Are PlayerPrefs even stored on the device (if I close the game and reopen it, will it still be there?)? What are other options? I work as a web developer so a simple json file is what comes to my mind but I’m not sure if this is how it works in game development.

Thanks

Jonas

Hi :-)!

I think u would have a look on this:

  • Make a empty GameObject and parent all User-Creations in there.
  • PrefabUtility.CreatePrefab(“somewhere”, ) or something like that

So I can create a prefab for each map and store them on the server? RLY? That’s awesome!

but wait… how are prefabs created? Wouldn’t the size of the prefab be too big? I mean, I already have all the necessary object models in my Game/App, so I only need to store position, rotation and model name. No need to upload many of those with each prefab, am I right?

You can’t create prefabs at runtime.

You could use Aeronaut’s suggestion to put the user-created level under a single GameObject and serialize that GameObject hierarchy, maybe to XML or JSON as you mentioned. When loading a level, you’d just deserialize the data to recreate the GameObject hierarchy. You could save the serialized data as a blob or a big string to a database server.

PlayerPrefs on web builds can store strings up to 1 MB in size, which will probably allow a fairly big level depending on what data you record. PlayerPrefs are stored on the device. If you want to share levels, a server is probably a better option.

ok, I’ll give it a try, thanks for helping out