Skip to content

UnityAddressablesFS

Namespace: Shadop.Archmage.Sdk

Implements the IFS interface to load files via Unity Addressables. Only LoadAtlasAsync is supported, and it must be called from the main thread.

public class UnityAddressablesFS : IFS

Inheritance Object → UnityAddressablesFS
Implements IFS

Remarks:

Each asset is released as soon as it is read, so an asset bundle may be unloaded and reloaded during a single load. Optionally, holding a handle to an asset in the bundle until loading finishes keeps the bundle from being unloaded. An empty placeholder file in the bundle works well for this purpose:

var pin = Addressables.LoadAssetAsync<TextAsset>("Assets/Configs/placeholder.txt");
await pin.Task;
try
{
await Archmage.LoadAtlasAsync(atlasFile, cfgRoot, atlas, options);
}
finally
{
Addressables.Release(pin);
}
public bool MainThreadOnly { get; }

Boolean

public UnityAddressablesFS()
public Byte[] ReadAllBytes(string path)

path String

Byte[]

ReadAllBytesAsync(String, CancellationToken)

Section titled “ReadAllBytesAsync(String, CancellationToken)”
public Task<Byte[]> ReadAllBytesAsync(string path, CancellationToken cancellationToken)

path String

cancellationToken CancellationToken

Task<Byte[]>

Always returns true. A missing file is reported by the read instead.

public bool FileExists(string path)

path String

Boolean

Always returns true. Addressables has no directory concept.

public bool DirectoryExists(string path)

path String

Boolean