+1 vote

Hi!
I have a function that does a lot of loops and calculations, this causes the game to hang for a moment and the pfs to go down. So I'm looking for a way to be able to do those calculations in a greater amount of time but without the game getting stuck or missing frames. I could use yields but it doesn't seem to be very efficient.

in Engine by (106 points)

1 Answer

+1 vote
Best answer

If you dont need the calculated data immediately, you can use multithreading.
Just start a new thread and check in every frame if it has finished (or use a signal). Then you can use the results.

by (1,448 points)
selected by

It worked for me, thanks!

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.