MeshButton3D with cloned Meshes

Hi,
I’m creating some simple 3d GUI buttons from a disc and then cloning them. For some reason though it only ever registers the onPointerClickObservable of the last button, but on all the buttons.

I assume this playground from the Documentation is suffering under the same bug :smiley:
https://playground.babylonjs.com/#8Y780Y#20
found here:

It works when creating a new Mesh instead of cloning an existing mesh.

Adding our GUI master @msDestiny14

1 Like

So the main difference I see with the two examples. Is one is cloning the meshes and then attaching GuiButton to that mesh. The other is just creating it all in one go. I’ve spent some time debugging it and not exactly sure where the issue is.

Would love to see the PG you are trying to make as well.

two examples?
What I’m trying to do is basically exactly what the playground from the documentation is doing.

Did you notice the problem in the playground? Every button is supposed to be clickable and output the clicked button nr in the console. But when cloning the mesh, no matter which button you hover over or click it alwas behaves as if you have clicked the last button that was created.
As you can see on this playground it works if the mesh is loaded 10 times instead of once and then cloned.
https://playground.babylonjs.com/#8Y780Y#183

Yes. I see. I thought you were referring to the PG in the thumbnail. Still debugging.

Fixed and merged. Thanks @msDestiny14

1 Like