Skip to content

A attribute/reflection based saving system. Mark variables/objects with a attribute and the saving system handles the rest

License

Notifications You must be signed in to change notification settings

Woreira/Attribute-Based-Saving

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Attribute-Based-Saving

Usage:

  1. add [Track] to your class
  2. add [Save] to your field
  3. save (call SaveSystem.Save()), if the tracking cache is not innitialized, it will be initialized automatically
  4. 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:

    //Example.cs
    [Track]
    public class Example : MonoBehaviour{
        [Save]public int x;
        [Save]public float y;
        [Save]public bool z;
    }

About

A attribute/reflection based saving system. Mark variables/objects with a attribute and the saving system handles the rest

Topics

Resources

License

Stars

Watchers

Forks

Languages