SaveStatus

Summary: Identify the outcome of a save or load operation.

Description

SaveResult and LoadResult<T> use SaveStatus to report the outcome. Inspect Message for details when a status can have several causes.

Namespace Gley.SaveSystem.

Declaration

C#
public enum SaveStatus

Members

ValueDescription
SuccessThe operation succeeded.
NotFoundThe requested save or slot was not found.
CorruptThe stored data is unreadable or fails integrity checks.
TamperedProtected data failed authentication.
UnknownEncryptionKeyNo known protection key matches the save.
NewerVersionThe save requires a newer format or data version.
StorageErrorThe storage operation failed.
SerializationErrorThe serializer or an upgrade could not process the data.
UnsupportedDataThe selected serializer cannot save the supplied data.
InvalidNameThe supplied save or slot name is invalid for the operation.

Example

Create CheckSaveStatus.cs, attach it to a GameObject and enter Play mode.

C#
using Gley.SaveSystem;
using UnityEngine;

public class CheckSaveStatus : MonoBehaviour
{
    private void Start()
    {
        LoadResult<Vector3> result = API.Load<Vector3>("position-sync-example");
        if (result.Status == SaveStatus.NotFound)
        {
            Debug.Log("This position has not been saved yet.", this);
            return;
        }

        Debug.Log($"Load status: {result.Status}", this);
    }
}
On This Page