SaveEventInfo

Summary: Identify the save and slot associated with a SaveService event.

Description

The shared SaveService passes SaveEventInfo to its save and load events. Use it to identify which operation a callback describes.

Namespace Gley.SaveSystem.

Declaration

C#
public class SaveEventInfo

Members

MemberTypeDescription
NamestringSave name. For a legacy path event, this is the original path or key.
SlotstringSlot name for a named save. Legacy path events can have a null slot.
IsLegacyPathboolTrue when the event comes from a legacy path-based operation.

Example

Create ReadSaveEventInfo.cs, attach it to a GameObject and enter Play mode. Attach this component alongside either Save example to print the save name and slot.

C#
using Gley.SaveSystem;
using UnityEngine;

public class ReadSaveEventInfo : MonoBehaviour
{
    private SaveService _service;

    private void OnEnable()
    {
        _service = API.Default;
        _service.SaveCompleted += OnSaved;
    }

    private void OnSaved(SaveEventInfo info, SaveResult result)
    {
        Debug.Log($"{info.Slot}/{info.Name}: {result.Status}", this);
    }

    private void OnDisable()
    {
        _service.SaveCompleted -= OnSaved;
    }
}
On This Page