Skip to main content

FactoryAsync

An abstract class in Alta.VContainerLayer.Runtime, the global namespace.

Base for factories that spawn a prefab loaded through Addressables. The prefab's AssetReference is injected, and loaded handles are released on dispose.

Constructors​

MemberWhat it is
protected FactoryAsync()Creates a FactoryAsync with default values.

Fields​

2 private and internal fields
MemberWhat it is
private readonly List<AsyncOperationHandle> assetHandlesAddressables load handles taken so far, released in Dispose.
private AssetReference prefabReferenceThe Addressables reference of the prefab this factory instantiates.

Methods​

MemberWhat it is
override void Dispose()Releases every Addressables handle this factory loaded, then disposes the created instances.
protected void Construct(AssetReference prefabReference)Injection method that stores the Addressables prefab reference to load.
protected Task<GameObject> LoadAsset()Starts loading the prefab through Addressables, keeps the handle for release, and returns the load task.