AddressableAssetManager

AddressableAssetManager

The AddressableAssetManager is a utility class designed to manage addressable assets in Unity. It facilitates the loading, instantiation, and releasing of assets, as well as handling game objects associated with those assets. This class is particularly useful when managing the lifecycle of assets loaded using Unity's Addressables system. It also offers asynchronous support via UniTask if UniTask is installed.

Public Methods

LoadAsset<T>

public object LoadAsset<T>(AssetReference assetReference)

InstantiateSync

public GameObject InstantiateSync(AssetReference assetReference, Vector3? position = null, Quaternion? rotation = null)

IsLoaded

public bool IsLoaded(AssetReference assetReference)

GetInstances

public List<GameObject> GetInstances(AssetReference assetReference)

GetFirstInstance

public GameObject GetFirstInstance(AssetReference assetReference)

DestroyAllThenRelease

public bool DestroyAllThenRelease(AssetReference assetReference)

DestroyAllWithoutRelease

public bool DestroyAllWithoutRelease(AssetReference assetReference)

DestroyAllWithoutRelease

public void DestroyAllWithoutRelease(AsyncOperationHandle handle)

Public Methods (UniTask)

Requires UniTask to be installed.

LoadAssetAsync<T>

public async UniTask<object> LoadAssetAsync<T>(AssetReference assetReference)

InstantiateAsync

public async UniTask<GameObject> InstantiateAsync(AssetReference assetReference, Vector3? position = null, Quaternion? rotation = null)

Public Events

OnInstanceDestroy

public event Action<AssetReference, GameObject> OnInstanceDestroy;

OnAssetUnloaded

public event Action<AssetReference> OnAssetUnloaded;

Last updated