Get Assets by class always return "Blueprint" classes objects

Hi, I’m having a problem using Get Assets by Class in the Assets Registry in UE5.2. I want to get all the blueprints inherited from a class I created: “Comprobation”.
But I don’t know how to filter to find only this class, the results are always 0.
So I tried another way, I search all the blueprints and then try to cast my class, but the cast always fail.

I also tried to Get Assets by path, but the result was the same. Does anyone know what I’m doing wrong?

Since UE5 the asset registry should be properly able to search for subclasses and provides out-of-the-box functions to do so.

Try node GetBlueprintAssets, with an ARFilter set to look for subclasses of your base class Comprobation.

The package path depends on where your Comprobation class resides.
If it’s a native class, use /Script/ProjectName.
If it’s a blueprint class, use package path like /Game/Blueprints/Comprobation and generated class name ie. Comprobation_C.

Once you’ve found some results, they are of type AssetData. This is just meta-data containing paths/names pointing to assets. The assets may not be really loaded in memory.

Also the AssetData point to the “main” object within the package, ie. the Blueprint (skeleton) which is probably useless to us (and not even available after packaging). I can’t find any “proper” way to go from asset path to class path, but it is very easy to do so manually, as generated classes always follow the same convention (append _C to the full blueprint path).

Once you have a full path to the class, you can query a load with either Sync Load Asset or Async Load Asset. The return value will be of type Object (but actually an UClass/UBlueprintGeneratedClass under the hood), which can be annoying because there isn’t direct convertion between Object and UClass in blueprints. Fortunately they also added a special node “CastToClass” seemingly recently to solve that. Then you finally get a proper class which you can use for real (eg. SpawnActor).

Here’s full example code to illustrate :

  • part 1 (finding assets)

  • part 2 (loading classes)

7 Likes

Wow, this is amazing, it works perfectly. Thank you so much for the good explanation and the photos!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.