Vault Save System

Attributes

Mark fields on a MonoBehaviour or ScriptableObject — they are scanned automatically when you call the builder overload Vault.Save(key, mb, build) or Vault.Save(key, so).

[Save]

Marks a field for inclusion in Save / Load object scanning.

public class PlayerStats : MonoBehaviour
{
    [Save] public int   health = 100;    // stored at "player.PlayerStats.health"
    [Save] public float speed  = 5f;     // stored at "player.PlayerStats.speed"

    [Save("gold_count")]
    public int gold = 0;                 // stored at "player.gold_count"

    public int transientScore;           // no [Save] — never written
}

[NoSave]

Prevents a member from being saved. Wins over [Save] — useful for suppressing a field inherited from a base class.

[Save][NoSave] public int ignored;  // NoSave wins

[VaultRename]

Lets Vault load from an old key name when you rename a field — no migration code needed for simple renames.

[Save]
[VaultRename("hp")]          // this field used to be called "hp"
public int health = 100;