Game Mode assets (blueprints) couldn't be found: Bug or Feature?

I tried two ways already: using UObjectLibrary and FAssetRegistryManager, none of them worked.
So what’s the task: I want to load assets dynamically, get list of maps, load specific map, get list of game modes, load specific game mode etc. With second one I have problems.
The most strange thing, that I can get list of maps, but can’t find any game mode (maybe because assets are actually blueprints? Derived from C++ classes though).

Code:


void ALevelController::GetAssets(TArray<FAssetData>& assets, UClass * classFilter, const TArray<FName>& paths) // Somewhere in my code this function returns assets array by given args
{
	FAssetRegistryModule& assetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
	FARFilter filter;
	filter.bRecursiveClasses = true; // Search everywhere
	filter.bRecursivePaths = true; // Same
	filter.ClassNames.Add(*classFilter->GetName()); // Currently there is only two classes I'am trying to get: UWorld (pure C++ class) and ARayGameModeBase (blueprints derived from this class)
	filter.PackagePaths = paths; // Predefined and 100% correct
	assetRegistryModule.Get().GetAssets(filter, assets); // This thing returns empty array when searching for game modes
}

So I ran program to point where it start finding me assets and started watching what FAssetRegistry::GetAssets doing.
After ExpandRecursiveFilter it correctly found several classes, that are children of ARayGameModeBase. It also found 2 paths: root path and one folder inside. Runs perfectly.
Then it skips part “only on disk assets”…
Then it goes through all classes: first it founds this class in memory, then trying to found every instance of it in memory.
So it goes through classes: it’s found Default_RayGameModeBase, found Default_RayGameModeBaseBP_C, it’s even found instanced RayGameModeBaseBP_C… But didn’t find Default_DeathmatchGameMode_C, probably because it’s not loaded, but that’s fine.
After, with this it goes in FAssetRegistryState::GetAssets to finalize this list. It conpares every asset in specified path with set CachedAssetsByPath.Find(PackagePath), but when it’s trying to set up class filter it fails every CachedAssetsByClass.Find(ClassName) call and gives empty array.
The problem that after intersecting paths with classes it gives empty array because it intersects filled paths array with empty classes array.
The reason why it’s empty is actually because TSet CachedAssetsByClass doesn’t contain any of classes of needed assets.

Maybe I forgot to load package? I don’t even know what package is and how it’s determined… There no detailed information in documentation of what exactly it is.

So I did an experiment. I removed class filter and left only paths - viola! It found every asset in this folder!
Wh… Why?

P.S. I also just noticed, that I can’t switch game mode during play… Though I can spawn another game mode and this one can be controlled by the main one… Right? Will anything break? Oh, well… Seems like I need to use travel even in this case.