Skip to content

About

Game data serialization system for Unity game engine

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

19 Commits

Folders and files

Repository files navigation

Unity Serialization System

Game data serialization system for Unity game engine.

How to use:

First make sure to use GameSerialization namespace:

using GameSerialization;

You can save your data in three ways:

  • using SaveableProperty attribute for your properties:
[SaveableProperty] public Vector3 vectorToSave {get; set;}
  • using SaveableField attribute for your fields:
[SaveableField] public Vector3 vectorToSave;
  • implementing IOnSaveGameMethod and IOnLoadGameMethod interfaces for your class:
public class ExampleSaveDataClass : MonoBehaviour, IOnSaveGameMethod, IOnLoadGameMethod
{
    private float dataToSave;

    public void OnSaveGameMethod(SerializationInfo info)
    {
        SerializationHelper.SaveObject(info, this, dataToSave, typeof(float));
    }

    public void OnLoadGameMethod(SerializationInfo info)
    {
        SerializationHelper.LoadObject(info, this);
    }
}

To trigger saving of your scene call:

public SavingManager savingManager;

...

savingManager.SaveGame(saveName);

To trigger loading of your scene call:

public SavingManager savingManager;

...

savingManager.LoadGame(saveName);

About

Game data serialization system for Unity game engine

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages