How to save maps from a runtime map creator?

Hello, I’ve been developing a Risk-type game in C# for the past months, and I wanted to implement a map creator to let players create their own maps from images in runtime and then play on them, like most of the strategy games have (like Age Of Empires).

I’ve created a scene in my game that is the level editor and I have created all the process of the map editing, but when I’m finished creating all what I need (attach the image to a plane, define the countries, create the neighbors of each other) I have a problem here: I don’t know how to save that new map to the game to use it in the future.

First I thought about creating a new prefab, but this is only available in Editor scripts, and I need to do that stuff in runtime.

I have searched a lot through the forum and Unity Answers but I haven’t been able to find a solution of my problem. I have tried with serialising my data to load it in the future, but I don’t know how can I serialize (and unserialize) a GameObject that defines a plane with children and an imge attached to it.

Can anyone help me to find a way to save my map in my project and then play with it? (all in runtime)

Thank you a lot!

There is a free module in the asset store for saving games, game objects etc. Search the asset store for “Save Game-JSON+Binary”.