0 votes

i create an unassigned var called thread.

    var thread

in ready i set thread as below

    thread = Thread.new()

in process i check if the thread is not active by doing

    if not thread.is_active():

This works fine in one gdscript I am using, but doesn't work in another?? I get the error as written in the title.

the two scripts are functionally identical when it comes to this point in threading, but only one seems to recognise thread as being a Thread at this point, while the other sees it as Nil

setting the unassigned var to this 'fixes' the issue,

var thread = Thread.new()

but later in the script I call


and I get this error:

wait_to_finish: Thread must exist to wait for its completion

The really confusing thing to me if it's set up identically in a prior script and doesn't give these errors at all. Any ideas?

Godot version 3.2.1
in Engine by (47 points)

1 Answer

+1 vote

This is some unintuitive bollock with threads :)
I couldn't get this until i saw this, I hope it will enlighten you too :

by (1,623 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.