Hi,
I am trying out the Async Framework and it seems even with all that the function is still executing on game thread as my game sleeps(stops) for 8 seconds which I used to simulate the delay on another thread.
here is my code:
FString AAsyncFutureExample::AsyncFoo()
{
int para =1;
TFunction<FString()> bla = [para](){ FPlatformProcess::Sleep(8.0f); return FString::FromInt(para);};
auto A = Async(EAsyncExecution::Thread, bla);
return A.Get();
}
I call this blueprint Callable Function on begin paly and it stops my game for 8 seconds then it throws the 1 output.
If you call AsyncFoo(), then this is to be expected, because AsyncFoo() is not Asynchronous itself, but it calls one inside, which means it will only return after the async function called inside returns from sleep to return the value at the A variable, resulting in BeginPlay to have to wait for AsyncFoo() to complete after the sleep time.