What if mesh has same Name in GLTFLoader's result.scene?

I try to make save & load based glb model

My Structure
glb model(original 3d model) + save data(json) => Three.js render result

I load glb model via GLTFLoader in Three.js and then applied material information from save data

I use mesh.name as Identifier, it works fine until now
I wonder what if two or more meshes has same name in glb model?
How do i identify mesh? is there any way identify mesh without modifying origin glb?

Imagine you are in a party with two people named Alex. How are you going to avoid confusion when calling one of them? Can’t just go with “hey Alex” now, have to “yo, Alex in blue shirt” or “Alex with long hair”, or maybe “Alex number 2” :smiley: - well, same here, first you find all meshes named “Alex”, and then pick one of them based on some other property :man_shrugging:

1 Like

Thanks for replying!

threejs will automatically fix it, it appends indicies. alex_0, alex_1, …

1 Like


yepp I check it Thanks! I tested it at gltf

lol this sure does look fixed:
Screenshot 2022-12-06 at 17-45-27 three.js editor

I did not know it does that :smiling_face_with_tear: