Search Unity

how to save scene in game for respawn etc?

Discussion in 'Editor & General Support' started by steveh2112, Mar 12, 2020.

  1. steveh2112

    steveh2112

    Joined:
    Aug 30, 2015
    Posts:
    314
    I've done some research on this and as far as i can tell, you need to write your own serializer (or buy one from the asset store) if you want to save a scene at runtime so you can reload it as a respawn point.

    problem is when you have a complex game with AI NPCs running around, destructible objects, etc. etc, etc, that becomes a ton of work.

    you would think the great minds at unity would have come up with the other side of SceneManager.LoadScene, like SceneManager.SaveScene for example but its seems not.

    i see this https://docs.unity3d.com/ScriptReference/SceneManagement.EditorSceneManager.SaveScene.html but that's an editor thing, not an in game thing

    so maybe this thread is more of a whine than a question, but short or writing a serializer for all your scripts, or buying an asset and adding their serializer to all your scripts, what are the options?

    thanks

    BTW, i found this free asset https://assetstore.unity.com/packages/tools/input-management/extendable-save-system-151293 which looks a pretty nice starting point but still, i don't get why unity doesn't just have save whole scene at runtime built in
     
    Last edited: Mar 12, 2020
  2. stephenchildree

    stephenchildree

    Joined:
    Apr 17, 2019
    Posts:
    4
    Unfortunately, the only way to really do this is to save data on everything you want to keep track of between loads.

    The back end of a built-in "Save scene" function would be serializing everything anyway.