FindObject not working in packaged game after updating from UE5 EA to 5.01?

Hi, I’ve recently updated the engine from UE5 EA, to 5.01. And just finally finished the next build of my game.

However, upon packaging the game I discovered that FindObjects can’t find my BPs anymore, despite working previously. Any ideas on what needs to be changed?


	if (!ItemLibrary)
	{
		ItemLibrary = UObjectLibrary::CreateLibrary(TSubclassOf<AWSPickup>(), true, GIsEditor);
		ItemLibrary->AddToRoot();
		ItemLibrary->bIncludeOnlyOnDiskAssets = false;
	}
	ItemLibrary->LoadBlueprintAssetDataFromPath("/Game/Gameplay/Pickups");

	if (!ItemLibrary->IsLibraryFullyLoaded())
		ItemLibrary->LoadAssetsFromAssetData();

	ItemLibrary->GetAssetDataList(ItemAssets);

	int assetNum = ItemAssets.Num();

	for (int i = 0; i < assetNum; i++)
	{
		UClass* ClassToAdd;

		//Get class to use for spawning
		UBlueprint* GeneratedBP = Cast<UBlueprint>(ItemAssets[i].GetAsset());
		if (GeneratedBP)
			ClassToAdd = GeneratedBP->GeneratedClass;
		else
		{
			FString GeneratedClassName = ItemAssets[i].AssetName.ToString() + "_C";
			ClassToAdd = FindObject<UClass>(ItemAssets[i].GetPackage(), *GeneratedClassName);
		}
[2022.05.11-16.36.48:718][411]LogUObjectGlobals: Warning: Failed to find object 'Object None./Game/Gameplay/Pickups/Consumables/Repair'
[2022.05.11-16.36.48:718][411]LogStreamableManager: Failed attempt to load /Game/Gameplay/Pickups/Consumables/Repair
[2022.05.11-16.36.48:719][411]LogUObjectGlobals: Warning: Failed to find object 'Object None./Game/Gameplay/Pickups/Consumables/Boost'
[2022.05.11-16.36.48:719][411]LogStreamableManager: Failed attempt to load /Game/Gameplay/Pickups/Consumables/Boost
[2022.05.11-16.36.48:719][411]LogUObjectGlobals: Warning: Failed to find object 'Object None./Game/Gameplay/Pickups/Consumables/Armor'
[2022.05.11-16.36.48:719][411]LogStreamableManager: Failed attempt to load /Game/Gameplay/Pickups/Consumables/Armor
[2022.05.11-16.36.48:719][411]LogUObjectGlobals: Warning: Failed to find object 'Object None./Game/Gameplay/Pickups/Passives/Wedge'
[2022.05.11-16.36.48:719][411]LogStreamableManager: Failed attempt to load /Game/Gameplay/Pickups/Passives/Wedge
[2022.05.11-16.36.48:720][411]LogUObjectGlobals: Warning: Failed to find object 'Object None./Game/Gameplay/Pickups/Passives/MovementSpeed'
[2022.05.11-16.36.48:720][411]LogStreamableManager: Failed attempt to load /Game/Gameplay/Pickups/Passives/MovementSpeed
[2022.05.11-16.36.48:720][411]LogUObjectGlobals: Warning: Failed to find object 'Object None./Game/Gameplay/Pickups/Passives/Magnet'
[2022.05.11-16.36.48:720][411]LogStreamableManager: Failed attempt to load /Game/Gameplay/Pickups/Passives/Magnet
[2022.05.11-16.36.48:721][411]LogUObjectGlobals: Warning: Failed to find object 'Object None./Game/Gameplay/Pickups/Passives/HealthUp'
[2022.05.11-16.36.48:721][411]LogStreamableManager: Failed attempt to load /Game/Gameplay/Pickups/Passives/HealthUp
[2022.05.11-16.36.48:721][411]LogUObjectGlobals: Warning: Failed to find object 'Object None./Game/Gameplay/Pickups/Passives/DashBoost'
[2022.05.11-16.36.48:721][411]LogStreamableManager: Failed attempt to load /Game/Gameplay/Pickups/Passives/DashBoost
[2022.05.11-16.36.48:721][411]LogUObjectGlobals: Warning: Failed to find object 'Object None./Game/Gameplay/Pickups/Passives/BurstBarrel'
[2022.05.11-16.36.48:721][411]LogStreamableManager: Failed attempt to load /Game/Gameplay/Pickups/Passives/BurstBarrel
[2022.05.11-16.36.48:722][411]LogUObjectGlobals: Warning: Failed to find object 'Object None./Game/Gameplay/Pickups/Passives/AttackSpeed'
[2022.05.11-16.36.48:722][411]LogStreamableManager: Failed attempt to load /Game/Gameplay/Pickups/Passives/AttackSpeed
[2022.05.11-16.36.48:722][411]LogUObjectGlobals: Warning: Failed to find object 'Object /Game/Gameplay/Pickups/Consumables/Repair.Repair'
[2022.05.11-16.36.48:722][411]LogUObjectGlobals: Warning: Failed to find object 'Object /Game/Gameplay/Pickups/Consumables/Boost.Boost'
[2022.05.11-16.36.48:722][411]LogUObjectGlobals: Warning: Failed to find object 'Object /Game/Gameplay/Pickups/Consumables/Armor.Armor'
[2022.05.11-16.36.48:722][411]LogUObjectGlobals: Warning: Failed to find object 'Object /Game/Gameplay/Pickups/Other/Scrap.Scrap'
[2022.05.11-16.36.48:722][411]LogUObjectGlobals: Warning: Failed to find object 'Object /Game/Gameplay/Pickups/Passives/Wedge.Wedge'
[2022.05.11-16.36.48:722][411]LogUObjectGlobals: Warning: Failed to find object 'Object /Game/Gameplay/Pickups/Passives/Piercing.Piercing'
[2022.05.11-16.36.48:722][411]LogUObjectGlobals: Warning: Failed to find object 'Object /Game/Gameplay/Pickups/Passives/MovementSpeed.MovementSpeed'
[2022.05.11-16.36.48:722][411]LogUObjectGlobals: Warning: Failed to find object 'Object /Game/Gameplay/Pickups/Passives/Magnet.Magnet'
[2022.05.11-16.36.48:722][411]LogUObjectGlobals: Warning: Failed to find object 'Object /Game/Gameplay/Pickups/Passives/HealthUp.HealthUp'
[2022.05.11-16.36.48:722][411]LogUObjectGlobals: Warning: Failed to find object 'Object /Game/Gameplay/Pickups/Passives/DashBoost.DashBoost'
[2022.05.11-16.36.48:723][411]LogUObjectGlobals: Warning: Failed to find object 'Object /Game/Gameplay/Pickups/Passives/BurstBarrel.BurstBarrel'
[2022.05.11-16.36.48:723][411]LogUObjectGlobals: Warning: Failed to find object 'Object /Game/Gameplay/Pickups/Passives/AttackSpeed.AttackSpeed'

It looks like perhaps /Game/ is no longer the expected path to the content folder?

ItemLibrary is unique to the editor, right?

Is this the case:

The log is normal for the first time without warning. And then there’s the warning

If that’s the case, probably because the library lifecycle is wrong.

You need to call the following code when the program is finished running.

ItemLibrary->RemoveFromRoot();
ItemLibrary = nullptr;