What happens to the threads made with spawn()?

When I use the spawn() function, what happens to the thread I made? Does it stay forever, or does it get removed once the code in it is done running or at some other point?

1 Like

The task will be removed once the function returns. So you can yield and call wait() and stuff, but as soon as the function ends, the thread will be cleaned up.

Note that the task won’t start until 1-2 frames later, the same delay as calling wait().

6 Likes

Awesome. Thanks for the fast response!