0 votes

I am currently trying out the timer node to call a function, but at first glance it seems to be unable to activate a function that has an argument because I have to call the function by its name only.

func ready()
     timer = Timer.new()
     timer.set_wait_time(1)
     timer.connect("timeout", self, "activate")
     add_child(timer)
     timer.start()

func activate(arg)
     print(arg)

How can I use connect() in a way that lets me send an argument (a String in this case) to the function it calls?

in Engine by (12 points)

1 Answer

+1 vote
timer.connect("timeout", self, "activate", ["arg_value1", "arg_value2"])
by (9,615 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories