UWorldPartitionBuilder's and modifying nested worlds

I’ve written a UWorldPartitionBuilder that functions as a world validation system for us, I wanted to integrate automatic fixups, and it’s kinda working. I’m able to loop over the actors in the current WP world and fix them up. However - if I grab the actors that are ALevelInstances, grab their world softobjectptr and then use it in a FScopedEditorWorld to open it up and attempt to make changes - those actors will fail to be savable. Even though I’ve tried about a million different ways it feels like to detatch the linkers to ensure it could move the old asset to tmp so it can write the new asset, it fails due to unable to being able to get a lock on the file, which means there’s still a file handle open. I *suspect* the WP system maintains locks on loaded sublevels in a way i don’t understand that’s preventing me from doing this.

I’d love any guidance on how I can solve this.

Hi,

The team recommends loading and fixing the LevelInstance map as an extra step after the main WP level was GCed.

Martin

Can that be done with the builder or do i need to write my own? It didnt seem like it, since the builder more or less appears to keep the main map open for the lifetime it’s alive.

Your custom builder can GC the level once you are done with it. The HLOD builder (and others) use FWorldPartitionHelpers::DoCollectGarbage() as need to make sure that things are properly destroyed when required.

The extra step can either be part of the Builder implementation directly or it can leverage ShouldProcessAdditionalWorlds to use a different instance of the builder.