What is an alternative for deprecated SceneLoader.ImportMeshAsync?

Deprecated in this PR: Make SceneLoader module level functions PascalCase and add GetRegisteredSceneLoaderPluginMetadata by ryantrem · Pull Request #16154 · BabylonJS/Babylon.js · GitHub

Now linter gives a warning on using deprecated ImportMeshAsync but I don’t see a function that replaces it.

You can use BABYLON.appendSceneAsync("path/to/model.glb", scene).

See the announcement SceneLoader (and glTF) options for more details about the changes :slight_smile:

AppendSceneAsync doesn’t return meshes that are appended to the scene. It seems useless in my case. I want to have a reference to the appended mesh to manipulate it, so I don’t consider it a replacement for ImportMeshAsync.

In this case it is better to use LoadAssetContainerAsync, it has all needed options.
Note that loadAssetContainerAsync (starting with the small “l”) is deprecated.

1 Like

Refactored to use LoadAssetContainerAsync and manually appending loaded stuff to a scene — all works. Thanks.

3 Likes