docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface ISaveReadable

    Save opened for reading.

    Inherited Members
    IAsyncDisposable.DisposeAsync()
    IDisposable.Dispose()
    Namespace: Unity.PlatformToolkit
    Assembly: Unity.PlatformToolkit.dll
    Syntax
    public interface ISaveReadable : IAsyncDisposable, IDisposable
    Remarks

    A save must be disposed before it can be opened again. If ISaveReadable is opened, it must be disposed before calling OpenSaveReadable(string) or OpenSaveWritable(string) with the same save name.

    Methods

    ContainsFile(string)

    Checks if a file with the given name exists in the save.

    Declaration
    Task<bool> ContainsFile(string name)
    Parameters
    Type Name Description
    string name

    The name of the file.

    Returns
    Type Description
    Task<bool>

    Task containing a boolean indicating whether the file exists (true) or not (false).

    Exceptions
    Type Condition
    IOException

    There was an error reading the data.

    InvalidAccountException

    IAccount is signed out.

    InvalidSystemException

    ISavingSystem is invalid.

    See Also
    ISavingSystem
    OpenSaveReadable(string)

    EnumerateFiles()

    Enumerate files within the save.

    Declaration
    Task<IReadOnlyList<string>> EnumerateFiles()
    Returns
    Type Description
    Task<IReadOnlyList<string>>

    Task containing an IReadOnlyList of file name strings.

    Exceptions
    Type Condition
    IOException

    There was an error reading the data.

    InvalidAccountException

    IAccount is signed out.

    InvalidSystemException

    ISavingSystem is invalid.

    See Also
    ISavingSystem
    OpenSaveReadable(string)

    ReadFile(string)

    Returns data read from the given file.

    Declaration
    Task<byte[]> ReadFile(string name)
    Parameters
    Type Name Description
    string name

    The name of the file to load

    Returns
    Type Description
    Task<byte[]>

    Task containing a non-null array of data read from the file.

    Exceptions
    Type Condition
    FileNotFoundException

    Data for name is not found.

    CorruptedSaveException

    The save has become corrupted, an empty save from a failed commit is considered corrupted.

    IOException

    There was an error reading the data.

    InvalidAccountException

    IAccount is signed out.

    InvalidSystemException

    ISavingSystem is invalid.

    See Also
    ISavingSystem
    OpenSaveReadable(string)

    See Also

    ISavingSystem
    OpenSaveReadable(string)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)