Saving a procedurally generated dungeon?

I’ve managed to develop a script for generating procedural maps at runtime, using pre-made rooms. Each room has different sized place-holders for objects, walls, textures, etc. that are replaced with the proper object. (Similar to how Amplitude made Dungeon of the Endless)

My problem now is figuring out how to save the map after it’s been made, so the player can resume from where they left off. Everything in the map is parented to a single gameobject. From what I’ve read thus far, there’s no real way of saving gameobjects during runtime. The only thing that comes to mind is going through every object, and record all their transforms, hierarchy, etc. to a serializable file.

Anyone have a better solution?

Assuming you’re talking about (semi-)random procedural generation, you should be supplying a “seed” which specifies the initial value from which pseudo-random numbers are generated when you call, e.g. Random.Range. Run the same algorithm with the same seed and you’ll always get the same results.

So, to save your procedurally generated level, you need only save the seed value, which is a single int - simples.

Write it to a file, and read it on loading the game?