ISerializedRecord

The stored value of a record that implements this interface is automatically saved and loaded.

ISerializedRecord inherits IValueRecord.

Use EditorStats.GetKey to get a key based on the name of the class.

To store a value, use EditorStats.Set, EditorStats.Replace or EditorStats.Modify.

Example 1

using EditorStatistics;

public class MyRecord : IRecord, ISerializedRecord
{
    public string Key => EditorStats.GetKey<MyRecord>();

    public string GetValue()
    {
        return "My Value";
    }
}

Example 2

using EditorStatistics;

public class MyRecord : IRecord, ISerializedRecord
{
    public string Key => EditorStats.GetKey<MyRecord>();

    public MyRecord()
    {
        EditorStats.Set(Key, "My Value");
    }

    public string GetValue()
    {
        return EditorStats.Get<string>(Key, "");
    }
}

Last updated