Calling yield in GDNative c++?

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

Is there a way to call yield in c++? i tried to include both of GDScript.hpp and GDScriptFunctionState.hpp but it seems they both don’t implement this method.

:bust_in_silhouette: Reply From: Chekr

I tried utilizing yield() and it works just fine for me.

yield() should be included as a native part of c++, not any particular part of GDScript. I simply included the <thread> library in my cpp code and was able to use it.

Alternatively, I’m not sure which compiler you are using, but your settings might be wrong. I am using g+±7 on linux, thus requiring the thread library to do my build (-lpthread option). I can also cross-compile this properly for windows using mingw with the pthread lib for mingw installed.

What error message are you receiving when trying to use yield()?