loadSuspend

@JvmStatic
suspend fun loadSuspend(uriString: String): Entity

Asynchronously loads a 3D model from the specified URI string and returns its root entity.

For content:// scheme, use Entity.loadSuspend(contentResolver: ContentResolver, uri: Uri) instead.

Return

The loaded root entity, which is attached to the scene. If any error occurs during the loading process, an ResourceLoadingException will be thrown.

Parameters

uriString

The URI representing the location of the 3D model to load. Currently supported schemes include asset:// and file://.


@JvmStatic
suspend fun loadSuspend(file: File): Entity

Asynchronously loads a 3D model from a file and returns its root entity.

Return

The loaded root entity, which is attached to the scene. If any error occurs during the loading process, an ResourceLoadingException will be thrown.

Parameters

file

The file containing the 3D model data to load. Supported file formats are .usdz and .glb.


@JvmStatic
suspend fun loadSuspend(contentResolver: ContentResolver, uri: Uri): Entity

Asynchronously loads a 3D model from a content provider URI and returns its root entity.

For asset:// or file:// scheme, use Entity.load(uriString: String) instead.

Return

The loaded root entity, which is attached to the scene. If any error occurs during the loading process, an ResourceLoadingException will be thrown.

Parameters

contentResolver

The ContentResolver for accessing the content provider.

uri

The content Uri pointing to the 3D model data. Only content:// scheme is supported.


@JvmStatic
suspend fun loadSuspend(inputStream: InputStream, format: ModelFormat): Entity

Asynchronously loads a 3D model from an InputStream and returns its root entity.

Return

The loaded root entity, which is attached to the scene. If any error occurs during the loading process, an ResourceLoadingException will be thrown.

Parameters

inputStream

The InputStream containing the raw model data.

format

The ModelFormat of the source of the InputStream that should be specified explicitly.


@JvmStatic
suspend fun loadSuspend(modelName: String, bundle: AssetBundle): Entity

Asynchronously loads an entity from the specified model name in the AssetBundle, and the root node will be returned as an entity.

Return

The loaded root entity, which is attached to the scene. If any error occurs during the loading process, an ResourceLoadingException will be thrown.

Parameters

modelName

The name of the model in the asset bundle.

bundle

The asset bundle containing the model.