Godot Version
v4.1.1.stable.official [bd6af8e0e]
Question
I’m trying to send a signal from a node up to its parent. This signal has an integer value being sent up as a parameter like so:
playerInputReceived.emit(number)
This is not a static value and depends upon some previous calculations happening in the child.
In the parent _ready function I have the following:
func _ready():
connect("playerInputReceived", processInput())
However, the function processInput
takes an argument. What I want is for the emitted signal parameter number
to be passed into processInput as an argument. How do I direct that signal argument into processInput?
The only approach I can think of is to have a global variable for number
to be assigned to and then passing that into processInput
or similarily having a number
variable in the parent, setting the value from the child node (through get_parent) and going forward. I want to know if there is a more elegant way of doing this though : )