-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Threads dont work with optional arguments #38042
Comments
I think this is because the |
I think it may be because on this line we can see that the arg number is hard coded : |
I tried to replace the 1 with a zero on the line i linked before and it worked with this code : extends Node2D
var thread : Thread
func _ready():
thread = Thread.new()
thread.start(self, "do_stuff")
do_stuff()
func do_stuff(optional_var : int = 0):
print("HURRAY!")
func _exit_tree():
thread.wait_to_finish() |
Threads don't really works as signals, signals can accept multiples parameters but thread just let you give one |
Fixes godotengine#38042. (cherry picked from commit 78ead60)
Godot version:
v3.2.1
OS/device including version:
Windows 10
Issue description:
Starting a new thread on a function with optional arguments doesn't work as expected.
Both calling the function normally and calling the function by emitting a signal works perfectly as expected.
Minimal reproduction project:
Gives following error when running:
Evidently running the start thread command with an actual integer as argument does work.
The text was updated successfully, but these errors were encountered: