x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to get a float value of a FAssetData?

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?

Product Version: UE 4.10
Tags:
more ▼

asked Jan 04 '16 at 05:39 PM in C++ Programming

avatar image

Braindrain85
411 36 47 143

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

(Re-)saving all the assets inside the editor fixed the problem.

more ▼

answered Jan 07 '16 at 10:00 AM

avatar image

Braindrain85
411 36 47 143

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question