Daily Unreal Column #74 - AssetRegistrySearchable
When working with big sets of data it is advisable to be very cautious when gets and what doesn't get loaded into the memory. AssetRegistrySearchable meta tag makes it all so much easier. Here is how.
If you use Asset Registry to find all existing assets using a specific query, for example, by filtering them by class like that
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
TArray<FAssetData> AssetData;
const UClass* Class = UStaticMesh::StaticClass();
AssetRegistryModule.Get().GetAssetsByClass(Class->GetFName(), AssetData);
you probably don’t want to load all of them into memory. Unfortunately, in order to read an object property, it would need to be loaded. That is, unless its properties are being marked with AssetRegistrySearchable. A property with this tag is being added to a TagsAndValues map of the FAssetData structure. This allows us to find all objects, then filter them using these tags and values, and only load the ones we really need.
Example property declared as AssetRegistrySearchable:
UPROPERTY(Category=Texture, AssetRegistrySearchable)
TEnumAsByte<enum TextureFilter> Filter;