Cannot pass a value of type "String" as "Callable".

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

Here is the code:

func _on_envelope_timer_timeout():
	thread = Thread.new()
	thread.start("_thread_function", "dummy")

Edited to format the code. Use the Code Sample button.

Zylann | 2023-07-05 17:12

:bust_in_silhouette: Reply From: Zylann

In Godot 4.0 Thread.start now expects a Callable, not a function name:

Functions are treated as callables, so you can remove the quotes.

thread.start(_thread_function)

Also if you want to pass an argument, use Callable.bind:

thread.start(_thread_function.bind("dummy"))