Adding Text/Content to MeshButton3D

Have been messing around with 3D buttons that aren’t the standard square ones(i.e., HolographicButton and Button3D) and I noticed that there was a problem when trying to add text to a MeshButton3D.

https://www.babylonjs-playground.com/#8Y780Y#130

In the above playground line 42 “button.content = categoryDesc;” when uncommented complains of emissiveTexture failing to be assigned(it looks like button._currentMaterial is undefined). Is this something that I have to set myself? I looked at the docs and the source code but can’t seem to figure out why there’s a problem when setting the text in this way, compared to Button3D or HolographicButton3D.

This does not work because meshbutton3D is basically a 3D object only.

You cannot use 2D text or content in that context

If you want to use a MeshButton3D, you have to add the text on the mesh material itself

2 Likes

i see now, i thought the set content method was shared across all 3D GUI classes, not just button3d and holographicbutton3d. thanks.

1 Like