Material Box

Material Box

WEB Design & Material Images

Godot - Changing the Cursor to a Pointer on Hover for a Button

Godot

This code example shows how to change the cursor to a pointing hand when it hovers over a Button node using GDScript.


To change the cursor to a pointing hand when it hovers over a Button node in GDScript, set the `mouse_default_cursor_shape` property to `2`.
You cannot specify this property using a string like `pointing_hand`. The value must be an integer.

# Create a Button node
var button = Button.new()
add_child(button)
button.set_text("Button")

# Change the cursor to a pointer on hover
button.mouse_default_cursor_shape = 2

Godot

TitleGodot - Changing the Cursor to a Pointer on Hover for a Button

CategoryGodot

Created

Update

AuthorYousuke.U