AssetLoader Class
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.
internal sealed class AssetLoader : Brine2D.Assets.IAssetLoader, System.IDisposable
Inheritance System.Object → AssetLoader
Implements IAssetLoader, System.IDisposable
| Methods | |
|---|---|
| GetOrLoadCoreAsync<T>(RefCountKey, Func<CancellationToken,Task<T>>, CancellationToken) | Tracks the key on both this scope and the shared cache, executes the load, and rolls back both ref counts if the load faults or the caller's token is cancelled. When cancellation wins the race against a completing load, the asset may remain in the cache with no live ref count until the next load of the same key or Brine2D.Assets.AssetCache.DisposeAsync. |