If I want to start a task asynchronously so that it does not block the game, and when it finishes that task fires an event to indicate that it has finished, how can I do this? The task would be the execution of a method of a class and I suppose that at the end of that method I can use a delegate.
What I’m doing is that when the player enters a level I have to load a thing which takes a long time, so I want to display a “Loading…” message. When it has finished loading, I want to hide the message.
AsyncTask(ENamedThreads::AnyThread, []()
{
// This code will run asynchronously, without freezing the game thread
AsyncTask(ENamedThreads::GameThread, []()
{
// This code will be executed on the game thread
});
});