Hello,

I've been writing a plugin that displays a button in the editor; this button is supposed to create an object, and connect one of its events to one of its methods.

The connect() function does link the two, but the icon doesn't appear next to the object's name in the node list, and the connection is lost when the scene is reloaded.

There doesn't seem to be a "Signal" class, so I'm not sure how else to go about this.

How can a signal be permanently connected to a method in a .gd tool script?

Thank you.

(Godot version 3.4.2)

Okay, so it turns out that connect() accepts certain flags, such as CONNECT_PERSIST.

Using this flag solves the problem, displaying the icon and preserving the connection when reloading the scene.

For example:

my_node.connect( "signal_name", my_node, "my_function", [], CONNECT_PERSIST );

The fourth argument is an empty array for the parameter list, and the fifth specifies that the connection is to be permanent.

9 months later