Skip to content

Instantly share code, notes, and snippets.

@fenix-hub
Last active September 5, 2020 13:58
Show Gist options
  • Save fenix-hub/8b22d832abb5b73a8db2e395637e279a to your computer and use it in GitHub Desktop.
Save fenix-hub/8b22d832abb5b73a8db2e395637e279a to your computer and use it in GitHub Desktop.
"""
This example uses a simple scene with a Control node as the root and a single Button as a child,
but could be applied to any case scenario.
"""
extends Control
func _ready():
$Button.connect("pressed", self, "on_pressed", [$Button.name, $Button.text, $Button.CUSTOM_VAR])
# @CUSTOM_VAR if the button has its own script
func on_pressed(_button_name : String, _button_text : String, _button_custom_var : Variant):
print("The button named %s was pressed, containing '%s' in its text and with a custom variant: %s"%[_button_name, _button_text, _buttom_custom_var])
New Gdscript file!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment