Godot Version
4.7
Question
Hey there, guys. So for my game, i need to make sign which’ll show text when the mouse hovers over it. Right now, i’m just using plain text without a border around it, but it would look cool if i could add that(and customise it). If any of y’all know how to do this please let me know. Thanks.
Use signals mouse_enter and mouse_exit on node you want react and make tooltip(label node) and then just connect it to script and change visibility of your made tooltip.
Hi there!
My first question back to you would be if you imagine the sign to be 3D or 2D or just plaintext.
Depending on that you need different nodes for displaying text.
For an interface based on plain text (or Control nodes) there is Labels. Labels also work in 2D projects, because in Godot Control nodes are related to 2D nodes.
For an interface in 3D there is Label3D. It displays a text in a 3D world.
thanks for responding! im working in 2d, and im using a label(forgot to mention that, my bad)
In that case you could connect a function to the mouse_entered signal in order to do what you want to do:
func setup_label():
$Label.mouse_entered.connect(_on_label_mouse_entered)
func _on_label_mouse_entered():
my_function()
$Label.text = 'text shows'
There is also mouse_exited. Label has these things, because it is a Control node.
@artemisia mentioned that already.