How to display material name by hovering mouse

Help me. Thank you!
The editor has the same effect,I want to display the name after hovering over the material。It’s very important to me. I’ve been working overtime for 17 days。


Add bounding box to the element. And when the ray cast from the camera to the mouse pointer hit the target just show the name.
Or
See this in a way how button works.
https://developer.playcanvas.com/en/tutorials/ui-elements-buttons/

I am not sure if these are optimized solution but I think it will work.

thank you!I use imported 3D model, this method is not applicable

you can use the Picker to pick the object under the mouse.
https://developer.playcanvas.com/en/api/pc.Picker.html

This gives you a mesh instance under the mouse cursor. You can access the material on it as well, and likely find out its asset name too.

example: PlayCanvas Examples

2 Likes