Mesh importing bug

Hi guys,

hope you’re well. Presumably I’ve found a bug with importing meshes.

After I import a mesh with BABYLON.SceneLoader.ImportMesh, it becomes impossible to turn the imported meshes off, i.e. setEnabled them false or make them mesh.isVisible = false.

I don’t know if this is an intended behaviour.

Please check the playground:
https://playground.babylonjs.com/#4F33I3#398

Thank you!

1 Like

Hey there, I think the issue is that you aren’t using the onSuccess callback to wait for the meshes to be loaded before trying to use them. Here I used this callback to disable the new meshes as soon as they’re done loading. :slightly_smiling_face:
https://playground.babylonjs.com/#4F33I3#400

2 Likes

Yeah, that’ve helped! Thank you!

I’ve tried to use the callback as well, only that I’ve used not the newMeshes variable but another name for it and this didn’t work in that case.

1 Like

Hmm, you should be able to use whatever names you want for the params to your onSuccess function. IDK what would be wrong with it, but if you can make another PG where it’s not working we can get it sorted out, if you’re still having an issue with it. :slightly_smiling_face: :beers:

1 Like