unload

inline suspend fun <T> unload(path: String): Boolean

Removes asset loaded with the given path and T type and all of its dependencies. Does nothing if asset was not loaded in the first place. Will not dispose of the asset if it still is referenced by any other assets. Any removed assets that implement Disposable will be disposed.

Note: only assets that were explicitly scheduled for loading with load, loadAsync or loadSync, or manually added to storage with add should be unloaded. Dependencies of assets will be removed automatically along with the original assets that caused them to load in the first place.

Assets scheduled for loading multiple times must be explicitly unloaded multiple times - until the asset is unloaded as many times as it was referenced, it is assumed that it is still used. Manually unloading dependencies of other assets (that were not scheduled for loading explicitly) might lead to unexpected runtime exceptions.

Will log all exceptions related to unloading of the assets. Silence the logger to avoid exception logging.

Returns true if the asset was present in the AssetStorage. Note that if the asset is still referenced (i.e. load was called multiple times or the asset is a dependency of an asset that is still loaded), the asset will not be disposed of and will remain in the storage even if true is returned.


suspend fun unload(descriptor: AssetDescriptor<*>): Boolean

Removes asset described by the descriptor and all of its dependencies. Does nothing if asset was not loaded in the first place. Will not dispose of the asset if it still is referenced by any other assets. Any removed assets that implement Disposable will be disposed.

Note: only assets that were explicitly scheduled for loading with load, loadAsync or loadSync, or manually added to storage with add should be unloaded. Dependencies of assets will be removed automatically along with the original assets that caused them to load in the first place.

Assets scheduled for loading multiple times must be explicitly unloaded multiple times - until the asset is unloaded as many times as it was referenced, it is assumed that it is still used. Manually unloading dependencies of other assets (that were not scheduled for loading explicitly) might lead to unexpected runtime exceptions.

Will log all exceptions related to unloading of the assets. Silence the logger to avoid exception logging.

Returns true if the asset was present in the AssetStorage. Note that if the asset is still referenced (i.e. load was called multiple times or the asset is a dependency of an asset that is still loaded), the asset will not be disposed of and will remain in the storage even if true is returned.


suspend fun unload(identifier: Identifier<*>): Boolean

Removes asset loaded with the given identifier and all of its dependencies. Does nothing if asset was not loaded in the first place. Will not dispose of the asset if it still is referenced by any other assets. Any removed assets that implement Disposable will be disposed.

Note: only assets that were explicitly scheduled for loading with load, loadAsync or loadSync, or manually added to storage with add should be unloaded. Dependencies of assets will be removed automatically along with the original assets that caused them to load in the first place.

Assets scheduled for loading multiple times must be explicitly unloaded multiple times - until the asset is unloaded as many times as it was referenced, it is assumed that it is still used. Manually unloading dependencies of other assets (that were not scheduled for loading explicitly) might lead to unexpected runtime exceptions.

Will log all exceptions related to unloading of the assets. Silence the logger to avoid exception logging.

Returns true if the asset was present in the AssetStorage. Note that if the asset is still referenced (i.e. load was called multiple times or the asset is a dependency of an asset that is still loaded), the asset will not be disposed of and will remain in the storage even if true is returned.