How do I get a list of all blueprint classes, that are a child of a specific blueprint at runtime?

I’ve spent hour searching for a solution for this.

In short, you can get all the blueprint classes with this code:

	TArray<FAssetData> BlueprintAssets;
	FARFilter Filter;
	Filter.ClassPaths.Add(UBlueprint::StaticClass()->GetClassPathName());
	Filter.bRecursiveClasses = true;
	Filter.bRecursivePaths = true;
	AssetRegistry.GetAssets(Filter, BlueprintAssets);

All you have to do is to find your class in the list and build the “generated class” (i.e. the class that represents your blueprint):

for (FAssetData const& BlueprintAsset : BlueprintAssets)
{
    const FAssetTagValueRef GeneratedClassTag = BlueprintAsset.TagsAndValues.FindTag(FName("GeneratedClass"));
    if (GeneratedClassTag.IsSet())
    {
        FTopLevelAssetPath ClassPath(GeneratedClassTag.GetValue());
        if (DerivedClassNames.Contains(ClassPath))
        {
            // Now we can retrieve the class 
            FStringBuilderBase Builder;
            Builder << BlueprintAsset.PackageName << '.' << BlueprintAsset.AssetName << "_C";
        }
}

More information here: How to Browse All Blueprint Assets of a Defined Type in Unreal Engine – Flo GameDev blog

5 Likes