The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

So, I have three buttons: casual, adventure, and extreme.

I can't figure out how to script them so that only one can be toggled. I want it so I can't toggle both casual and adventure or all of them at the same time. I tried using signals, but they don't seem to work

Godot version v3.5.1
in Engine by (15 points)

2 Answers

0 votes
Best answer

If you assign any number of buttons to a common ButtonGroup, they will effectively become radio style buttons, allowing only 1 to be pressed at a time. For example, if you create 3 Buttons and set their toggle_mode to true. Then, do something like:

func _ready():
    var grp =
    $ = grp
    $ = grp
    $ = grp

That should get you close to the behavior you want (note, you can also use CheckButton in place of the above Buttons).

by (22,674 points)
selected by

I tried it and it works! Thank you!

0 votes

A Checkbox button has a property for that, the TOGGLE MODE under BaseButton section, also you can use the ICONS section under Theme Overrides and put your own icons for a toggle mode.

Just loop an array with your buttons to reset the pressed mode for each button
and set up your desire button in pressed mode.

by (190 points)
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 Frequently asked questions and 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 [email protected] with your username.