Detected objects loaded in PostLoad while streaming

When I attempt to play an experience in Lyra, i’m seeing warnings come up such as:
LogStreaming: Warning: Detected 341 objects loaded in PostLoad while Streaming, this may cause hitches as we’re blocking async loading to pre-load them.
What is this? Is there any way to find out what objects are being loaded in PostLoad?
The level i’m currently testing on is the default open world test map that UE provides, with Lyra experience loaded, and the loading time is taking quite a long time, which maybe because of the above warnings (100’s of them in the log).
This is tested using the 5.1 version of Lyra project.

2 Likes

If you search in the c++ source for parts of the message you will find it in \Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading.cpp in the function FAsyncPackage::PostLoadDeferredObjects.

The array ObjLoadedInPostLoad contains all the objects and can be inspected in debugger. I don’t know what Lyra wants, but in our project it seems to be a lot of blueprint internal stuff, like events and functions, components, etc. Things we do not have control over at all.

I tried to cook and run DebugGame. Got none of the errors. But the code does not seem to run at all outside editor(?). At least no breakpoint could be set now. Maybe this means it can only happen in editor.

Thanks for the reply. Could it also be references to objects set in data tables causing this? Lyra uses a lot of soft asset references and async loading, but in stuff that’s been imported from UE4 development still has object references, not soft object references.

Also getting this

Warning: Detected 26 objects loaded in PostLoad while streaming, this may cause hitches as we’re blocking async loading to pre-load them.

How fix?

LogStreaming: Warning: Detected 30 objects loaded in PostLoad while streaming, this may cause hitches as we’re blocking async loading to pre-load them.

This appears to be a new warning that started appearing for me when entering PIE (once only, each time after starting editor) after upgrading from 5.0.3 to 5.1.1. This occurs during my project’s loading screen while data is being asynchronously loaded in (via the StreamableManager’s RequestAsyncLoad function).

The warning is being called from line 7024 of AsyncLoading.cpp.

Context:

if (ObjLoadedInPostLoad.Num())
			{
				// If there were any LoadObject calls inside of PostLoad, we need to pre-load those objects here. 
				// There's no going back to the async tick loop from here.
				UE_LOG(LogStreaming, Warning, TEXT("Detected %d objects loaded in PostLoad while streaming, this may cause hitches as we're blocking async loading to pre-load them."), ObjLoadedInPostLoad.Num());

The warning seems to have been added in the following commit: https://github.com/EpicGames/UnrealEngine/commit/298b2383a33130e9786551994cc6e3b544b72e23

The warning is a little tricky to understand, but I think it can probably be understood as indicating that unloaded prerequisites (hard references) to Async loaded objects are being synchronously loaded in during/after each load which can cause hitching. So in order to resolve this, the prerequisites should be async loaded in advance or perhaps in the same async load request? For example, if I am loading an array of UMG Widgets, should I also include all the texture and materials used by them in the RequestAsyncLoad call? Not really sure what the recommended workflow/implementation is.

Given the FSoftObjectPath to an asset, is there an easy way to recursively async load in all referenced assets as well? (or at least find them and add them to an array so they can all be passed in to FStreamableManager::RequestAsyncLoad together?)

4 Likes

I’m not getting the warning on entering PIE anymore after upgrading from 5.1.1 to 5.2.1.

Looks like this was fixed on the Engine side, at least for the situation in which the issue was occurring on my end.