![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Fenisto |
I have a main node script and a child node script.
And I want to generate a value on mouse movement, store it in a variable Type and send this variable to a child node where it will be used as a reference to a dictionary.
On the main node I have this:
var Type
signal Send_signal
func _ready():
connect("Send_signal", get_node("child"), "Set_type", [Type])
func _on_Area_mouse_entered():
Type = *Generated by a function value*
emit_signal("Send_signal")
And on the child node I have
func Set_type(Type):
Class = Type["name"]
var *Generated by a function value* = {name = "bob"}
Clearly a missed something in the process of understanding of how to create a custom signal. Can you tell me what?
the syntax for connect is connect("signal_name", signal_target_node, "signal_function")
Then emit should go like emit_signal("signal_name", [argument])
. Inside those brackets put the arguments of the function. Then in signal_target_node
, for you it’d be your child node, put func signal_function(argument1):
The parameters to your signal function should be in emit_signal
not connect
Michael Antkiewicz | 2020-01-19 03:32
emit_signal("signal_name", [argument])
It doesn’t looks like you need brackets there. Or it will send it just like that, as “[argument]”
But thank you anyway.
Fenisto | 2020-01-19 10:36