Custom signal not connected?

Godot Version

4.3

Question

Hello!
I am currently trying to make a custom signal in a global autoload, sending the signal between two scenes. I’ve tried following guides, and it has worked before, but not here.

The signal is set up in my Global script like this:
billede

The signal is then emitted in my “get_item” scene, which is basically just a button for now, while I’m just testing and seeing if stuff works:
billede

The signal should then be connected to my Item resource (item.gd, which is used to make all items), and call a function. I put a print command in there to test if it works, but nothing is printed in console, so it seems like the signal is not received at all?

Any idea why this could be? Is it because it’s a resource and not a script added to a node?
I tested the button press with a print command as well, and “on pressed” seems to be working at least.

classes extending from resource dont have a _ready method that gets called, since they dont enter the tree.
Instead you can use the _init()-method:

func _init():
    Global.get_item.connect(get_item)
1 Like

I had no idea! That’s really good to know, thanks! It worked right away.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.