add

inline suspend fun <T> add(path: String, asset: T)

Adds a fully loaded asset to the storage. Allows to avoid loading the asset with the AssetStorage and to manually add it to storage context.

T is the type of the asset. Note that a superclass of the asset can be chosen to associate the file with. path must be a unique ID that will be used to retrieve the asset. Since the asset is loaded manually, it does not have to be an actual file path.

Throws AlreadyLoadedAssetException if an asset with the same path is already loaded or scheduled for loading.


suspend fun <T> add(identifier: Identifier<T>, asset: T)

Adds a fully loaded asset to the storage. Allows to avoid loading the asset with the AssetStorage and to manually add it to storage context.

T is the type of the asset. Note that a superclass of the asset can be chosen to associate the file with. identifier uniquely identifies the assets and defines its type. Since the asset is loaded manually, Identifier.path does not have to be an actual file path. See getIdentifier.

Throws AlreadyLoadedAssetException if an asset with the same path is already loaded or scheduled for loading.


suspend fun <T> add(descriptor: AssetDescriptor<T>, asset: T)

Adds a fully loaded asset to the storage. Allows to avoid loading the asset with the AssetStorage and to manually add it to storage context.

T is the type of the asset. Note that a superclass of the asset can be chosen to associate the file with. descriptor contains the asset data. See getAssetDescriptor.

Throws AlreadyLoadedAssetException if an asset with the same path is already loaded or scheduled for loading.