How can I export a runtime scene and import it into a game?

Hi! I’m making a runtime editor and I want to export the scene (game) made in it and import it into a game. Can you give me any indication of where to start studying?

You’re going to have to figure out a way to serialize all the data that comprises the scene:

  • References to prefabs (as string prefab names, or using Addressables)
  • positions/rotations/scales of those prefabs
  • Any state of those objects that is not part of the prefab itself (maybe a spawned-in light switch is turned on rather than its default of being off)
  • Any other game logic related to your game specifically and any relationships between those objects.

Gather all that data, serialize it to a file, and then write the opposite logic that can deserialize all of it and re-instantiate all the objects in the appropriate places and states.

It’s not trivial and it depends heavily on how your game in particular is set up.

1 Like

This topic is basically the same as creating a save game system. There’s lots of threads on the topic.

1 Like