UE5 Anyway to know if partition world load finished

UWorldPartitionEditorLoaderAdapter* EditorLoaderAdapter = WorldPartition.Get()->CreateEditorLoaderAdapter<FLoaderAdapterShape>(World, LoadRegion, TEXT("Loaded Region"));

EditorLoaderAdapter->GetLoaderAdapter()->SetUserCreated(false);
EditorLoaderAdapter->GetLoaderAdapter()->Load();

//wait for load complete

//do something

After calling Load(), how can I block the program to ensure the scene is fully loaded and visible? I’ve attempted calling the following interfaces, but some rendering resources still aren’t fully prepared.

World->BlockTillLevelStreamingCompleted();
FAssetCompilingManager::Get().FinishAllCompilation();
FlushRenderingCommands();
GEngine->ForceGarbageCollection(false);

//some rendering resources still aren't fully prepared here.

[Attachment Removed]

Steps to Reproduce[Attachment Removed]

Hello!

You might need to have the engine tick a couple of frames before all async processes are completed. I would also recommend that you add the following when “flushing”

FAssetCompilingManager::Get().ProcessAsyncTasks();

Can you share more details on what operations you plan on doing on the loaded world? Can you share the type of asset that is not in a ready state after you waited? Different classes have different ways to initialize and there is not a single way to confirm everything is ready other than ticking a few warm up frames.

If you plan on modifying the loaded part of the world or to generate some data\stats, it could be more appropriate to create a new UWorldPartitionBuilder. Those are executed on the full world through a commandlet by iterating over cells of size 1024m (default). The base WP builder code does run one Fake engine tick before running the builder code. Some builders (ie UWorldPartitionMiniMapBuilder) need some extra warm ups (search for InNumWarmupFrames).

Regards,

Martin

[Attachment Removed]

Hello,

What you describe as a “baker” is the use case that the Builders have been created for. I recommend that you consider this option. The UWorldPartitionBuilder takes care of segmenting and loading the world using small chunks iteratively. It also takes care of running the garbage collector to avoid running out of RAM between the iterations. If you build your tool in the editor, you will likely run out of memory while processing whole WP levels as the editor cannot unload loaded assets. Only levels and their instances can be destroyed by the garbage collector. Commandlets can destroy all the data type which reduces the risk of running out of RAM.

You might still need to make sure the FAssetCompilingManager work is done and also might have to “pump” a few ticks using FWorldPartitionHelpers::FakeEngineTick but the base code would get you much closer while avoiding memory issues.

There are a lots of implementation examples in the Engine which you can use as inspiration.

https://dev.epicgames.com/documentation/en\-us/unreal\-engine/world\-partition\-builder\-commandlet\-reference

Regards,

Martin

[Attachment Removed]

thank you, I will try​

FAssetCompilingManager::Get().ProcessAsyncTasks();

In my logic, I first divide the world into chunks, loading one small chunk (200m x 200m) at a time. Then I pass the contents of that chunk to my own baker for baking. However, I encountered a situation where the InstanceRenderData is nullptr. But if I wait for 120 seconds after loading, this issue doesn’t occur. So I think that certain rendering resources haven’t been initialized right after call :

EditorLoaderAdapter->GetLoaderAdapter()->SetUserCreated(false);

EditorLoaderAdapter->GetLoaderAdapter()->Load();

World->BlockTillLevelStreamingCompleted();

FAssetCompilingManager::Get().FinishAllCompilation();

FlushRenderingCommands();

GEngine->ForceGarbageCollection(false);

[Attachment Removed]