Signal does connect, but doesn't call. While 2 other signals do

Godot Version

Question

The following function is called when the button is pressed:

func return_card_to_hand(card: TextureButton) -> void:
    var new_card = card.duplicate()
    cards.add_child(new_card)
    new_card.visible = true
    new_card.pressed.connect(new_card.dumb)
    new_card.mouse_entered.connect(new_card._on_cards_mouse_entered)
    new_card.mouse_exited.connect(new_card._on_cards_mouse_exited)
    cards.cards_in_hand.append(new_card)
    cards.redraw_cards()
    print("is_connected:")
    print(new_card.pressed.is_connected(new_card.dumb))

func dumb():
    print("dumb")

The log says:

is_connected:
true

But “dumb” is not printed when the button is pressed.

It’s probably something, well, dumb.

But the problem is both _on_cards_mouse_entered() and _on_cards_mouse_exited() are connected and working properly.

And they seem to me identical…?

It’s driving me insane.

//Thanks for any help in advance.

Is dumb part of new_card or self?

I think dumb is self from the code you have provided.

It’s a part of the new_card - yes.
But I already found the problem while this post was approved.

It did indeed was something dumb.
I thought return_card_to_hand() was the signaled function - judging by the name. I mean, that is what was happening when I pressed the button.

But it turns out it was only a part of the higher branching function, that was handling several types of inputs and redistributing it down from a singleton.
I just tunnel-visioned on this one script.

And there was the problem - higher up.
(It was deleting and storing all of the ‘pressed’ connections from the buttons on the screen. I just had to move the function call 1 line down - after it was done.)

The moral of the story: “Never tunnel vision.”
…I guess.

//Now I just need to find how to close this topic…

1 Like

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