Godot custom Signal not emit

Godot Version

4.2.1

Question

I have been working with signals for a while, but I have encountered a problem with a simple signal. The signal is created at the beginning of the code with
signal StartMovement.
Then, it is triggered during the code execution and called with
StartMovement.emit().
I added a print statement to check if the function is indeed triggered (it is). Then, I connected the signal to a node from the tree (as before), and what is in this function simply does not start.

How are you trying to connect the signal? Is the node/scene emitting the signal a child of the node trying to connect to the signal?

We probably will have to see some code to check further and being able to see the scene tree would help too.

1 Like

Screenshot 2024-07-14 183711

The signal comes from the TextBox and goes to the CharacterController.


A few ways to solve this I think.

Personally, I prefer to either:

  1. signal up to the root node and call down to the child node.
  2. create a signal bus autoload and use that to connect to and emit the signal.

I personally, don’t connect via the Node tab if I’m going from a node to it’s sibling. To me, it sounds like something isn’t quite right with your Character connecting to the signal. You could theoretically try something like getting a reference to the Textbox node in the character script then add text_box.StartMovement.connect() to the ready function. This route may work, but I personally would go with one of the routes I listed above instead.

1 Like

Thank you for your help!
I’m going to try to implement it. Can I message you if I have any problems?

Your best bet is to reply here. I may be working on something or away from the PC.

Good luck.

Thanks