UnityAddressablesGreedyFS
Namespace: Shadop.Archmage.Sdk
Implements the IFS interface to load files via Unity Addressables, reading all files in each
encountered asset bundle in one go.
Only LoadAtlasAsync is supported, and it must be called from the main thread.
public class UnityAddressablesGreedyFS : IFSInheritance Object → UnityAddressablesGreedyFS
Implements IFS
Remarks:
On WebGL, UnityAddressablesFS takes about one frame per file, because Unity completes at most one asynchronous asset load per frame. This class instead reads every file in an asset bundle synchronously the first time a file in that bundle is requested, and keeps the other files in memory until they are requested.
This class reads every file in the bundle, so a bundle that also holds other files costs extra time and memory. Keep configs in asset bundles of their own. Files that are never requested stay in memory until the instance is garbage collected.
Properties
Section titled “Properties”MainThreadOnly
Section titled “MainThreadOnly”public bool MainThreadOnly { get; }Property Value
Section titled “Property Value”Constructors
Section titled “Constructors”UnityAddressablesGreedyFS()
Section titled “UnityAddressablesGreedyFS()”public UnityAddressablesGreedyFS()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. For a missing file, ReadAllBytesAsync throws FileNotFoundException.
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