Search Unity

Question I want to make a save system for my level editor.

Discussion in 'Scripting' started by PanicMedia, Apr 13, 2021.

  1. PanicMedia

    PanicMedia

    Joined:
    Dec 6, 2020
    Posts:
    37
    I am currently working on a 2D mario maker style game and I have no idea on how I should go about making the save system for ot, Does anyone know of a way I could do it or if there are any tutorials.
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,914
    Think about what data you need to save:
    • placed objects (type, position, scale, rotation, any other settings on them)
    • player spawn position
    • whatever else
    Think about how to serialize it to a file.
    Think about how to read the data back from the file

    Think about how to set the scene back up from the deserialized data.

    Solve these problems and you will have a working save system. A level editor isn't really any different from a saved game for any other game. The principles are the same.
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,752
    Any tutorials... only about eight million of them, give or take.

    Screen Shot 2021-04-13 at 9.57.57 AM.png

    Also, here are my own mumblings about load/save. Start small, iterate, don't try to save / load EVERYTHING at once, you will never get through it.

    Load/Save steps:

    https://forum.unity.com/threads/save-system-questions.930366/#post-6087384

    Don't use the binary formatter/serializer: it is insecure, it cannot be made secure, and it makes debugging very difficult, plus it actually will NOT prevent people from modifying your save data on their computers.

    https://docs.microsoft.com/en-us/dotnet/standard/serialization/binaryformatter-security-guide