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 : IFSInheritance 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);}Properties
Section titled “Properties”MainThreadOnly
Section titled “MainThreadOnly”public bool MainThreadOnly { get; }Property Value
Section titled “Property Value”Constructors
Section titled “Constructors”UnityAddressablesFS()
Section titled “UnityAddressablesFS()”public UnityAddressablesFS()Methods
Section titled “Methods”ReadAllBytes(String)
Section titled “ReadAllBytes(String)”public Byte[] ReadAllBytes(string path)Parameters
Section titled “Parameters”path String
Returns
Section titled “Returns”ReadAllBytesAsync(String, CancellationToken)
Section titled “ReadAllBytesAsync(String, CancellationToken)”public Task<Byte[]> ReadAllBytesAsync(string path, CancellationToken cancellationToken)Parameters
Section titled “Parameters”path String
cancellationToken CancellationToken
Returns
Section titled “Returns”FileExists(String)
Section titled “FileExists(String)”Always returns true. A missing file is reported by the read instead.
public bool FileExists(string path)Parameters
Section titled “Parameters”path String
Returns
Section titled “Returns”DirectoryExists(String)
Section titled “DirectoryExists(String)”Always returns true. Addressables has no directory concept.
public bool DirectoryExists(string path)Parameters
Section titled “Parameters”path String