loadSync

inline fun <T> loadSync(path: String, parameters: AssetLoaderParameters<T>? = null): T

Blocks the current thread until the asset with T type is loaded from the given path.

This method is safe to call from the main rendering thread, as well as other application threads. However, avoid loading the same asset or assets with the same dependencies with both synchronous loadSync and asynchronous load or loadAsync, and avoid running this method from within coroutines.

This method should be used only to load crucial assets that are needed to initiate the application, e.g. assets required to display the loading screen. Whenever possible, prefer load and loadAsync.

Might throw the following exceptions:

If the asset was already loaded, added or scheduled for loading, this method will either return the asset immediately if it is loaded, or throw MissingAssetException if it is unloaded. In either case, it will increase the reference count of the asset - see getReferenceCount and unload for details.


fun <T> loadSync(identifier: Identifier<T>, parameters: AssetLoaderParameters<T>? = null): T

Blocks the current thread until the asset with T type is loaded with data specified by the identifier and optional loading parameters.

This method is safe to call from the main rendering thread, as well as other application threads. However, avoid loading the same asset or assets with the same dependencies with both synchronous loadSync and asynchronous load or loadAsync, and avoid running this method from within coroutines.

This method should be used only to load crucial assets that are needed to initiate the application, e.g. assets required to display the loading screen. Whenever possible, prefer load and loadAsync.

Might throw the following exceptions:

If the asset was already loaded, added or scheduled for loading, this method will either return the asset immediately if it is loaded, or throw MissingAssetException if it is unloaded. In either case, it will increase the reference count of the asset - see getReferenceCount and unload for details.


fun <T> loadSync(descriptor: AssetDescriptor<T>): T

Blocks the current thread until the asset with T type is loaded using the asset descriptor.

This method is safe to call from the main rendering thread, as well as other application threads. However, avoid loading the same asset or assets with the same dependencies with both synchronous loadSync and asynchronous load or loadAsync, and avoid running this method from within coroutines.

This method should be used only to load crucial assets that are needed to initiate the application, e.g. assets required to display the loading screen. Whenever possible, prefer load and loadAsync.

Might throw the following exceptions:

If the asset was already loaded, added or scheduled for loading, this method will either return the asset immediately if it is loaded, or throw MissingAssetException if it is unloaded. In either case, it will increase the reference count of the asset - see getReferenceCount and unload for details.