Unable to retrieve all meshes once imported in the scene

Hi all,

I am trying to import meshes using SceneLoader.ImportMesh method, however, when I try to access all meshes using scenes.meshes, the only one that appears is ground, despite me being able to see the objects in the scene. After reading documentation on SceneLoader I thought ImportMesh function imports meshes in the scene, so why am I not able to see them in scenes.meshes array?

        var loadMeshes = function(name, filename, x) { 
                BABYLON.SceneLoader.ImportMesh('', "path", filename, scene, function (meshes) {
                        var mesh = meshes[0];
                        mesh.position = new BABYLON.Vector3(x, 5, 5) ;
                        mesh.name = name;
                })
        }

Hey and welcome!

Well we will need more info like a reproduction of your issue in the Playground because we cannot do a lot with the few lines of code you shared

1 Like

It takes some time to fully load meshes. Try console.log -ing “scene” then look for meshes. It may look empty, but when you click meshes, it updates and shows all meshes inside the scene.

Check out this post on StackOverflow.