Connecting to a function with arguments

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

Alright, so you used to be able to connect with connect(signal, node, function, [methods])

Now I see connections have been changed to connect(signal, "callable"), how do I fix this to work with methods?

:bust_in_silhouette: Reply From: zhyrin

Every method is a callable.

func callback(parameter) -> void:

signal my_signal(parameter)

func _ready() -> void:
    var receiver = get_receiver()

func procedure() -> void:
    var value = ...

I found the proper way to do it which is connect(signal, function.bind(method))

RebiDesi | 2023-03-22 05:12