#Connecting signal in signal dock duplicates function and fails to connect

9 messages · Page 1 of 1 (latest)

short cove
#

I have a function called clicked_menu_changed_button. When I try to connect to it using the signal dock, the script creates a new empty function of the same name, complains that I can't have duplicate function names, and fails to connect the signal.

The error I get is: Function "function_name" has the same name as a previously declared function. The duplicate function didn't exist until after the engine tried to make it though.

I could probably give up on the signal dock entirely and connect all the signals in the script, but I would prefer not to if I can avoid it. This was working on previously connected nodes, so I don't get why there is a problem connecting new nodes now.

covert marlin
short cove
#

arguments are both a single string. I used the advanced section to add it in

#

for connecting to an existing signal, I did select the existing script and select the function so I don't get why it keeps making a new function

covert marlin
#

that confuses me as well, although i am not that experienced when it comes to connecting to already existing functions using the editor interface. i tend to use connections via code more. but i understand that it being possible is still important.

#

what happens when you just remove the automatically generated function? does it then connect the the original one on play?

short cove
#

no since there's no connection in the dock

#

I think the order of operations is as follows:

  1. I have my saved function that I want to use
  2. I tell the signal dock to use the saved function on the specified script
  3. the signal dock thinks I'm making a new function of that name on the specified script
  4. the script adds a new function but has an error since the new function has the same name as the intended function
  5. the editor stops what it was doing, so the signal never gets attached to the node
#

I've tried removing the newly created function and that stops the error, but the other issue is that the error seems to be have already interrupted the attachment