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"

Asset Registry can't find files.

I'm trying to find assets of a type and decided the asset registry would be a better way than to have a massive array of "loaded assets" The trick is that I'm not actually getting any results back from the Asset Registry. I tried looking for something basic and got the

    //Load the module
     FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
     //Setup output array
     TArray<FAssetData> AssetData;
     //Get the asset Registry and find assets of type RWallTile, store in AssetData, include subclasses
     AssetRegistryModule.Get().GetAssetsByClass(ARWallTile::StaticClass()->GetFName(), AssetData,true);
     //Output the result for testing
     UE_LOG(LogTemp, Warning, TEXT("Found %d Assets of type %s"),AssetData.Num(), *ARWallTile::StaticClass()->GetFName().ToString());

This results in the following being output

 LogTemp: Warning: Found 0 Assets of type RWallTile
Product Version: UE 4.17
Tags:
more ▼

asked Apr 02 '18 at 07:02 PM in C++ Programming

avatar image

Justin.Dooley
2.1k 103 64 155

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

1 answer: sort voted first

Are you sure the call to ARWallTile::StaticClass()->GetFName() is giving you what you want? I use Asset Registry heavily in my game and I usually just hard-code the names of the classes I want to find. I've noticed that Asset Registry wants the class name to be the name of the class without the "A", "U", "S", "F", etc prefix.

So since you're looking for all assets of type ARWallTile, pass in the string "RWallTile" into the asset registry call. That's how I do it in my game and it works fine.

Though, I do have issues with asset registry and standalone builds of my game. You may want to make sure the assets you want to load are actually being cooked and packaged when you ship your build, otherwise you end up with bugs like this one.

more ▼

answered Jan 13 '19 at 08:06 PM

avatar image

Watercolor Games
1

avatar image Justin.Dooley 3 days ago

Thanks for the reply. I've actually abandoned this approach a few months ago. Instead we went with a slightly more restrictive approach of having a specific naming convention. Then we parse the name and can identify an asset that way.

(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