Godot Version
4.3 stable
Question
I use signals in my code and just notices something, that I don’t really understand, maybe someone can help. Sometimes I need to use .bind() to use a parameter in a signal method, sometimes I don’t need to use it, examples:
This works:
enemy.combat_started.connect(_on_enemy_combat_started)
func _on_enemy_combat_started(p_enemy: Enemy) -> void:
This does not work:
_dice.pressed.connect(_on_dice_pressed)
func _on_dice_pressed(p_dice: Dice) -> void:
Instead I have to write this:
_dice.pressed.connect(_on_dice_pressed.bind(_dice))
func _on_dice_pressed(p_dice: Dice) -> void:
I wonder why that’s the case?
“enemy” is an Area2D that exists in my node tree in the Editor, “_dice” is a Button that is instanced at runtime.