• Godot Help2D
  • How to check if the button is hovered with mouse

I made that when cursor hovers over the button it will change its texture, but I need it to send a signal that will show text with info about this button, how can I check mouse cursor hovering over the button?

  • Erich_L replied to this.
  • TraitPhoe You can customize it via a Theme or by overriding the _make_custom_tooltip(). Check the docs for details.

    Using is_hovered() is also fine but it won't work for other types of controls. Besides, why doing manually something that's already supported out of the box.

    You can use button's mouse_entered() and mouse_exited() signals. However if you want to have something like a tooltip, all gui controls already have it built in. Just set the tooltip_text property.

      xyz Sorry, I just inserted random things and found is_hovered() function. But about tooltips: can I somehow redact them and give another background or font? Cuz standart background or even blank ones is plain bad for me

      • xyz replied to this.

        TraitPhoe You can customize it via a Theme or by overriding the _make_custom_tooltip(). Check the docs for details.

        Using is_hovered() is also fine but it won't work for other types of controls. Besides, why doing manually something that's already supported out of the box.

        TraitPhoe All controls have the gui_input signal from which you can determine if the mouse has entered or left a control's rect.