Run a class method asynchrounously, with a delegate to motify when it ends?

Hi!

I’m using Unreal 5.3.2 with C++.

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.

How can I do this?

Thank you.

you cant just use asyncloadasset() for this?

@Auran131 No, they aren’t assets. Thanks.

This is what I need:

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
	});
});

I’ve found it in this article: How to use async task in Unreal Engine | Georgy's Tech Blog

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.