Objects color is applyed to multiple objects instead of 1

Hello , i use dat Gui to alter the color of SELECTED object.

It always applies to the same N objects.

I start with SELECTED = box
(box = THREE.Mesh(

Every time i click on an object SELECTED = intersected[0].object
And so the datGui changes the value from the Selected.

When i add some objects and change one’s color, some other objects take it as well, even though my SELECTED is a THREE.Mesh , so just one object.

And the color from datGui is assigned to selected

How is it possible that the SELECTED is interpreted as an array of meshes?

All objects in image were treaded the same, they are all part of the same array, and each object is a separate gltf file. Thank you

this happens when your objects share the same material.
Try using using material.clone() when you create the mesh.
or use a different material.


Thanks , worked perfectly