I have a hard time trying to communicate using custom signals. I have a group of
Objects that I'm trying to communicate clicks to player.
print("object clicked", obj)
var player_ref = null
print("connecting ", self, " to player ", player)
connect("object_clicked", player, "_on_object_clicked")
#player_ref = player
func on_input(viewport: Viewport, event, shape_idx):
if event is InputEventMouseButton and event.is_pressed():
print("emiting signal", self)
I am calling
connect_clicks_to_player in a singleton. I see
connecting being printed, with correct nodes,
emitting signal being printed, but not
_on_object_clicked in Player. Player also claims in
get_incoming_connections that this signal is connected.
I also tried moving the signal to the singleton class, following this answer, but it didn't change anything.
At the same time, when I stored the reference to the player directly instead (uncommenting the two lines) code runs correctly. What am I doing wrong?