How to get a float value of a FAssetData?

Pseudocorpus
Mon, 04 Jan 2016 17:39:27 +0000
Blueprint

I was about to create an object library of certain objects like this:

//Create object library
		TArray<FAssetData> AssetDatas;
		UObjectLibrary* ObjLib = UObjectLibrary::CreateLibrary(ASomPickup::StaticClass(), true, GIsEditor);

		//Load data of the pickup class into the object library
		ObjLib->AddToRoot();
		ObjLib->LoadBlueprintAssetDataFromPath(TEXT("/Game/Pickups/" + PickupSubPath));


		ObjLib->GetAssetDataList(AssetDatas);

print(FString::FromInt(AssetDatas.Num()));

So far so good. It all works well and objects are being found. Now I want to read a certain float-value of the classes:

for (int32 iList = 0; iList < AssetDatas.Num(); iList++)
		{
			FAssetData& AssetData = AssetDatas[iList];

			const FString* FoundTypeNameString = AssetData.TagsAndValues.Find(GET_MEMBER_NAME_CHECKED(ASomPickup, SpawnProbability));

			if (FoundTypeNameString)
			{
				print("FOUND");
			}
		}

But “FOUND” is never being printed, even though the corresponding float is marked as “AssetRegistrySearchable”:

//The probability with which the item will be spawned
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Defaults, AssetRegistrySearchable, meta = (ClampMin = 0.0, ClampMax = 1.0, DefaultValue = 1.0))
		float SpawnProbability;

Does anyone have a clue what the problem might be or what I could do to get the float-value of an unloaded class?

2 posts - 1 participant