This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
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 = ButtonGroup.new()
    $Button.group = grp
    $Button2.group = grp
    $Button3.group = 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,704 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.