ListSlots

Summary: List the existing save slots.

Description

List the existing save slots. If storage cannot be read, the API logs a warning and returns an empty list. Cache the list if you display it repeatedly, and refresh it after changes to the slots.

Declaration

C#
public static IReadOnlyList<SlotInfo> ListSlots();

Returns

An IReadOnlyList<SlotInfo> containing the existing save slots.

Example

Create LogSaveSlots.cs and attach it to an active GameObject. Enter Play mode to print the names of the current save slots in the Console.

C#
using System.Collections.Generic;
using Gley.SaveSystem;
using UnityEngine;

public class LogSaveSlots : MonoBehaviour
{
    private void Start()
    {
        IReadOnlyList<SlotInfo> slots = API.ListSlots();

        foreach (SlotInfo slot in slots)
        {
            Debug.Log(slot.Name, this);
        }
    }
}
On This Page