Godot Version 4.2.1
Question
I have a script with these signals defined, but emit_signal always returns ERR_UNAVAILABLE for one and never for the other:
signal dash_started(pos: Vector2)
signal dash_cooldown_ended(pos: Vector2)
# ... cut ...
func _dash(direction: Vector2) -> void:
# ... cut ...
_dash_cooldown_timer.start()
var err: Error = emit_signal("dash_started", position)
assert(err == OK) # this always works
await _dash_cooldown_timer.timeout
_is_dashing = false
err = emit_signal("dash_cooldown_ended", position)
assert(err == OK) # this always fails
When I check in the debugger err
is 2
, that would be ERR_UNAVAILABLE
.
The doc for emit_signal
says:
Returns @GlobalScope.ERR_UNAVAILABLE if
signal
does not exist or the parameters are invalid.
I’m fairly sure I’m just missing something obvius here, but why the first emit_signal always works and the second one always fails?