Skip to content

Commit 9810a63

Browse files
authored
Fix Choice Buttons wrongly connecting (#1888)
* Fix choice buttons connected too many times. If a choice gets revisited, it errors because of connecting to the `BaseButton.pressed` again. * Update signals on already connected buttons.
1 parent a7f565c commit 9810a63

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

addons/dialogic/Modules/Choice/subsystem_choices.gd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,12 @@ func show_choice(button_index:int, text:String, enabled:bool, event_index:int) -
121121
node.shortcut = shortcut
122122

123123
node.disabled = not enabled
124+
125+
if node.pressed.is_connected(_on_ChoiceButton_choice_selected):
126+
node.pressed.disconnect(_on_ChoiceButton_choice_selected)
127+
124128
node.pressed.connect(_on_ChoiceButton_choice_selected.bind(event_index,
125-
{'button_index':button_index, 'text':text, 'enabled':enabled, 'event_index':event_index}))
129+
{'button_index':button_index, 'text':text, 'enabled':enabled, 'event_index':event_index}))
126130

127131
if node.choice_index > 0:
128132
idx = node.choice_index

0 commit comments

Comments
 (0)