Download

[4.17.2] FindImportClassAndPackage & Linker->Preload don't work properly in packaged game,but editor

To create a maplist, i decided to build the same system Epic uses for UnrealTournament. Extending WorldSettings with a new property-object which holds summary information and at runtime, extract/load that specific summary object from a map. However, i noticed things are quite different in packaged games.
Here is the code from UT (since i can’t share project source atm):
https://github.com/EpicGames/UnrealTournament/blob/f96172e8177ba990110efd26a7438b9bfa415bae/UnrealTournament/Source/UnrealTournament/Private/UTGameEngine.cpp#L962

The asset specific stuff had to be changed since AssetRegistry is a bit different in 4.17.2 compared to the version UT uses. But from the part on after it, its the same. Right now, i have 2 of our maps loaded in editor and set summary info. This means these 2 maps use the new worldsettings and summary-object. Several other maps don’t(yet). From PIE (or Standalone from editor) Linker->FindImportClassAndPackage reports true on the 2 maps i have modified and false on the other maps not using the new stuff. That seems right. The rest of the code then runs like a charm. In a packaged build, this goes bonkers. Linker->FindImportClassAndPackage always reports true and Linker->Preload will always fail with an assertion. Even on those 2 maps i modified. The assertion is:
Assertion failed: InPos >= 0 && InPos <= TotalSizeOrMaxInt64IfNotReady() [File:D:\Build++UE4+Release-4.17+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading.cpp] [Line: 7183]

However i see no reason why this check fails only in packaged builds :confused:

So I’m guessing you have also duplicated the related code, in particular that relating to the level summary in UTWorldSettings.cpp? If so, when you package, the cooker will be loading these maps into memory, which will trigger the summary creation, and then serializing them, cooked. So to me, it makes sense that all your maps will be behaving the same in the cooked build.

Afraid I can’t help with the crash. It looks like some kind of serialization mismatch, where what got written to disk isn’t what the code doing the deserializing is expecting. Hard to say more than that.

Yes, my Worldsetting was extended accordingly. Thanks for the information on what the cooker does. But ultimately i haven’t found a solution :confused:

I have created an answerhub-post in addition. In case anybody has any help/hint/info/whatever:
https://answers.unrealengine.com/questions/723144/ut-like-levelsummary-flinkerpreload-fails.html