UE 5 Truly Asynchronous Actor Spawning With C++

You’re still doing all the “expensive” work on the game thread. You’re not really doing it asynchronously, you’ve just moved it to a different part of the game thread execution to do serially.

If I were trying to do this, I would use the BlueprintAsyncActionBase instead of the LatentInfos. Then I’d make my Async action tickable (by also inheriting from FTickableGameObject). During that tick, I would spawn some subset of SpawnDataArray. That could be N per frame or you could do timings so that you don’t spend more than X ms per tick on room spawning. Once all the actors are spawned, call OnComplete.

“Splatting” work across multiple frames is something that comes up enough that I wrote my own generalized utility for it. You can check it out here in my Starfire Utilities plugin. But that’s geared toward an entirely C++ workflow/trigger and not any sort of blueprint integration.

Of course all of this would be assuming that I had actually profiled this or had some actual reason to do it. If you’re spawning the rooms that the player(s) will move through, you’ve probably got to spawn all of those before you can actually start playing. Which probably means that you’re doing it behind a loading screen and you don’t really need to do things asynchronously behind a loading screen.

1 Like