public sealed class AssetScopeEverything loaded through it, released together.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
Loads go through the scope rather than being captured from ambient state. Doc 08 sketches this as using var scope = Assets.Scope(); with everything loaded inside attaching itself, and that reads beautifully until the first await: a load started inside the block and finishing after it has to belong somewhere, and neither answer is right. Ambient state and asynchrony do not compose.
Since the scope exists because implicit release semantics leak, replacing one implicit-lifetime rule with another would defeat the point. Being handed the scope you are loading through is one extra word and it is never ambiguous.
Fields and properties (1)
public int CountHow many handles the scope is holding.
Methods (2)
public AssetHandle<T> LoadAsync<T>(string address, CancellationToken cancellationToken = default(CancellationToken)) where T : classLoads an asset, and holds it until the scope ends.
public void Dispose()Releases everything loaded through this scope.
Used by (2)
- AssetManagerVixen.Assets
- AssetManagerTestsVixen.Assets.Tests