0 votes

I want all the buttons in my game to have the mouse_default_cursor_shape property set to "Pointing hand".

I can manually go and change them, but I would rather it be set by default.

I've been using themes to style the buttons so far, but I can't find a way to set the mouse pointer (or non-style options, like width) through a theme. Is this possible?

Godot version 3.3.2
in Engine by (31 points)

1 Answer

0 votes

You can create a script that extends Button, add a class_name to it and add this custom class_name-based node to your scenes:

extends Button
class_name MyButton

func _ready():
    mouse_default_cursor_shape = CURSOR_POINTING_HAND

In the scene tree dock, right-click a node and use Change Type to convert Buttons to MyButtons.

by (11,917 points)

Thanks Calinou, that does the trick :) Although I was hoping for a theme option or something, that way I could just use the default buttons. But I guess that's not possible atm.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.