Default AssetManager setup for maps doesn't work in packaged builds
The default setup of the AssetManager does not function in packaged builds: the Map asset type functions in PIE but not in a packaged build.
I haven't been able to fully figure out why this is happening, but it appears that the problem is probably related to the difference between UWorld and ULevel objects.
For the asset manager to be able to use an asset type as a Primary Asset in a packaged build, the asset's type has to implement a GetPrimaryAssetID function. For some reason this isn't the case when running in editor. (This is probably bad as it leads to nasty surprises when you package a build.) By default, the AssetManager is set up to locate all UWorld assets in the specified folder (Game/Maps by default). UWorld was modified with the addition of the AssetManager to have a GetPrimaryAssetID member to make them work with the AssetManager.
The problem is that UWorlds aren't assets. Maps are ULevel objects, which have a UWorld outer, but are not UWorlds themselves. As far as I'm aware, you'll never create a UWorld asset in the editor, they're created at runtime to house one or more ULevels.
It looks like there's some code somewhere which causes the AssetManager to find maps in the maps folder despite the fact that it's looking for UWorlds and the maps are ULevels. I'm not sure whether this was a specific exception for UWorlds, or if there are transient UWorlds created for the ULevels in editor, or what, but the magic stops as soon as running in a packaged build. (The packaged build failure to find any maps whatsoever is actually what I would expect to happen in all cases, since the AssetManager has been told to look for UWorlds and not ULevels, but whatever.)
To make matters worse, this isn't an easily fixable problem even in code, since there doesn't appear to be any way to reparent a ULevel to a new class. (If you were, for example, to create a new class which inherits from ULevel which implemented a GetPrimaryAssetID member.)
To get this to work, I think you'd currently have to add a UPrimaryDataAsset wrapper for ULevels in order to make them function. But basically all the work to make the AssetManager work out of the box for maps does nothing ATM outside of the editor, and furthermore since UPrimaryDataAsset is not a BlueprintType, it makes the AssetManager impossible to use at all in Blueprint-only projects.
The reason the maps aren't showing in the packaged build is the "Is Editor Only" checkbox in Project Settings. This means that maps are excluded from primary assets when the game is packaged. Unchecking this box should give you the list of maps you're looking for in your packaged game.
answered Nov 20 '17 at 07:51 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here