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)