Hi forum,
Question
When my program tries to emit a signal it gives the following errors. Any ideas why?
call: Can't call non-static function '_on_signal' in script.
emit_signal: Error calling method from signal 'the_signal'
Background
I have two scripts, call them primary
and secondary
. In primary
I connect a signal the_signal
to a function in secondary
by
# primary.gd
var secondary = load("res://secondary.gd")
signal the_signal()
func _ready():
self.connect("the_signal", secondary, "_on_signal" )
and in secondary
I have the receiving function
# secondary.gd
func _on_signal():
# doing some stuff