Skip to content

Assets

Brine2D

Brine2D.Assets Namespace

Classes
AssetCache Internal singleton that owns the asset caches, ref counts and native resource lifecycle. All public API goes through AssetLoader (the scoped IAssetLoader wrapper).
AssetLoader Scoped IAssetLoader wrapper that tracks all assets loaded within a DI scope and automatically releases them when the scope is disposed. Each scene receives its own instance, so assets are cleaned up during scene transitions without manual Release* or Unload calls.
AssetManifest Base class for typed asset manifests. Subclass it, declare your assets as AssetRef<T> fields, then pass the manifest to PreloadAsync(AssetManifest, IProgress<AssetLoadProgress>, CancellationToken) in your scene's OnLoadAsync.
AssetOptions Configuration for the asset loader: preload parallelism and teardown behaviour.
AssetRef<T> A typed, lazy asset reference. Declare fields of this type on an AssetManifest subclass, then call PreloadAsync(AssetManifest, IProgress<AssetLoadProgress>, CancellationToken) to resolve them all in parallel.
Structs
AssetLoadProgress Progress snapshot reported during asset preloading. Value type to avoid per-report heap allocations on the preload path.
RefCountKey Value-type ref-counting key that avoids boxing the per-asset-type cache keys (tuples, strings) into object.
Interfaces
IAssetLoader Unified async asset loading with caching. All asset types (textures, sounds, music, fonts) go through one service. Inject IAssetLoader into your scene or system constructor. No content pipeline, no build step: drag files into your assets folder and load them.
IAssetRef Non-generic interface used by AssetManifest to collect all typed refs via reflection without knowing the generic parameter.