paletteNo-Code: Saveable Components

Saving & Loading through Saveable Component

1

1. Add Components

Select any GameObject (like your Player, for example) and add:

  1. GlobalID component → Gives it a unique identity

  2. Saveable component → Handles saving & loading

circle-info

TIP: If you simply add Saveable component, GlobalID will be automatically added, as Saveable depends on it.

2

2 Select Fields to Save

In the Saveable inspector:

  • Find the component you want to access the fields to save.

  • Check boxes next to values you want to save (health, position, rotation... anything you need)

  • Choose Scope:

    • Scene: Data unique to this scene (enemy positions, door states)

    • Global: Data that crosses scenes (player stats, inventory)

3

3. Save & Load

  • The easiest way to test saving and loading:

  1. Create a new GameObject.

  2. Attach the SaveLoadShortcuts component.

Now you can:

  • Press S → Save your game.

  • Press L → Load your game.

Or, if you prefer buttons in your UI, hook Save() and Load() methods to them.


circle-info

Pro Tip: You can also call saving/loading directly from code if you prefer full control:

SaveManager.SaveAll(); // Save everything
await SaveManager.LoadAll(); // Load everything
4

4. Test in Editor

circle-info

You can also just use the Scene View Panel from OmniSave to Save & Load your games in the Editor!

Use the Scene View Panel (bottom-right in Scene view):

  • Click Save to save the current state

  • Click Load to restore it

  • Change slot numbers to test multiple save files

Save Private Fields & Properties

Use the [SaveableField] attribute to include private fields or properties in saves. The attribute lives in cowsins.OmniSave.APIarrow-up-right and works on both fields and properties.

Example #1

using cowsins.OmniSave.API;

public class Player : MonoBehaviour
{
    [SaveableField]
    private int health = 100;
}

Example #2

using cowsins.OmniSave.API;

public class Player : MonoBehaviour
{
    [SaveableField]
    private int Health { get; set; } = 100;
}

Tips & Considerations

circle-info

The Saveable inspector will list attributed members so you can tick them and choose scope (Scene or Global).

circle-info

For properties to persist, they must be both readable and writable (reflection must be able to get/set the value)

circle-info

The attribute works for public and private members

Last updated