Change name of the root with Unique ID


When I upload a model, it creates a new root and the objects get added to this root as children. Now I have multiple models in the scene, and each root that is created has its own Unique ID. Is there a way to change the root name with referencing its ID? If so, how?

BABYLON.SceneLoader.ImportMesh("", "Models/", "scene.glb", scene, function (newMeshes) {
        //change __root__ to Model_1
        newMeshes.forEach(mesh => {


you can change each mesh’s name by simply changing its name parameter to whatever you want. You can also get a mesh by its uniqueId (scene.getMeshByUniqueId), which will be the better way to go if it is possible to use it instead of the name.

Yes but the ID keeps changing when I refresh the page. Also I can’t go with getMeshByName because I am importing multiple models at same time so the system will get confused which model to look for. Is there a solution for this?

Staying dynamic is the one solution i would recommend :slight_smile:

Make a map between unique id and the models you are loding (update this map in the success callback of each individual mesh). This way you don’t mind if the unique id is different, it will always work as you intended it to.

1 Like