- add
[Track]
to your class - add
[Save]
to your field - save (call
SaveSystem.Save()
), if the tracking cache is not innitialized, it will be initialized automatically - load (call
SaveSystem.Load()
), if the tracking cache is not innitialized, it will be initialized automatically
be aware:
- unity classes are not serializable, so [Save] will not work on them.
- you may need to use SetupSettersAndGetters() manually to properly save recently instantiated objects:
This system works by setting up getter and setter functions, if you add/remove objects that are being tracked it will not throw a error, but may do unexpected stuff.
//Example.cs
[Track]
public class Example : MonoBehaviour{
[Save]public int x;
[Save]public float y;
[Save]public bool z;
}