So I’m on UE 4.8.3 source code with Steam SDK 1.36 fully integrated.
I have this particular c++ function that is BlueprintCallable to unsubscribe from a steam workshop item. Using the SteamAPI, this function creates a steam handler for the request and registers a CallBack function.
The c++ function then waits for the callback to finish before continuing on. Here’s the wait code:
while (pItem->m_SteamCRUnsubscribe.IsActive())
{
Sleep(100);
SteamAPI_RunCallbacks();
i++;
if (i > 50) // fail after 50 loops (5 seconds)
{
break;
}
}
My problem, is that when I do this in a blueprint ForEach loop, like unsubscribing from an array list of Workshop IDs; the game interface stops refreshing (My circular throbber freezes as well as all game interaction) until the loop has finished.
I’m fairly sure the c++ function is holding up the game thread. Even though the c++ code is only responsible for unsubscribing one item at a time, the BP is responsible for the loop and in between refreshes. So I need a way to call the c++ function in a thread safe manner, I just don’t know how.
I was hoping someone has run in this the before and its just a rookie coding mistake.