SaveResult

Summary: Inspect the outcome of a save, delete, or other operation that returns a result.

Description

A SaveResult reports whether an operation succeeded and carries details you can use when it fails.

Namespace Gley.SaveSystem.

Declaration

C#
public class SaveResult

Members

MemberTypeDescription
SaveResultConstructorSaveResult(SaveStatus status, string message, Exception exception)
Creates a result with the supplied status, message and exception.
StatusSaveStatusThe operation’s status.
IsSuccessboolTrue when the operation succeeded.
MessagestringAdditional information about the outcome. It can be empty.
ExceptionExceptionThe associated exception, or null when none was recorded.

IsSuccess

public bool IsSuccess { get; } returns true when Status is SaveStatus.Success.

Example

Create CheckSaveResult.cs, attach it to a GameObject and enter Play mode. Check the Unity Console to see the status returned by the save.

C#
using Gley.SaveSystem;
using UnityEngine;

public class CheckSaveResult : MonoBehaviour
{
    private void Start()
    {
        SaveResult result = API.Save(transform.position, "type-reference-position");
        Debug.Log($"Save status: {result.Status}", this);
    }
}
On This Page