Why are my signals not working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By wetbadger

Whether I connect them via the editor or in code, they don’t connect, and there is no error. I am not sure how this code is different from the Button nodes I use that work fine.

extends ScrollContainer

onready var scene = get_tree().get_current_scene()

func _ready():
	pass
	#connect_signals() #this does not work either
	
#func connect_signals():
#	connect("scroll_started", self, "_on_Scroll_scroll_started")
#	connect("scroll_ended", self, "_on_Scroll_scroll_ended")


func _on_Scroll_scroll_started(): #never connected or called
	scene.get_node("State/Camera2D").call_function(false)


func _on_Scroll_scroll_ended(): #never connected or called
	scene.get_node("State/Camera2D").call_function(true)
:bust_in_silhouette: Reply From: umma

Remove the # from Infront the functions also remove pass from beneath func _ready():. If “pass” is there the computer won’t read what’s beneath “pass”.

I have tried without the comments. Signals can be connected in the editor without calling connect() in code. But either way, is_connected(“scroll_started”, self, “_on_Scroll_scroll_started”) returns false.

wetbadger | 2022-07-24 01:42

:bust_in_silhouette: Reply From: omggomb

Seems like a known issue (bug):

Maybe you can use get_<v or h>_scrollbar.connect("scrolling", self, ... as a workaround. Depends on what you want to do of course.