Refer imported model

Hi!

Apologies for a very basic question to which I still haven’t found an adequate answer to. When I import a mesh (obi), what is the best way to promote it to variable so that I can refer to it, for example to change its material, from the code after loading the model?

I have my own attempts and can reliably refer to individual mesh component within the function loop after import them.

Kind thanks!

my favorite approach is to rely on the importMeshAsync with await so that the code looks pretty neat compared to the callback version.

3 Likes

ImportMeshAsync with await is def a nice way to go! glTF Loader Demo | Babylon.js Playground (babylonjs.com)

Took use of the situation and opened a PR adding some examples to our docs so people can find this information easier :slightly_smiling_face: Add usage of ImportMeshAsync by carolhmj · Pull Request #410 · BabylonJS/Documentation (github.com)

4 Likes