Skip to content

ShadedTechnology/GameSerializationSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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);

Releases

No releases published

Packages

No packages published

Languages