[Feature Request] Get parent class of a class

I’ve come across a scenario where I was surprised UE does not have a blueprint node for getting the parent class of a given class. There is a check for “Class is Child Of” which returns a boolean, but I’m hoping to provide a class and get its parent class for the sake of comparing if two different actors share the same parent class (I can’t even accomplish this through casting both to the same parent class and seeing if they’re both valid, because I don’t know what the parent to cast to is, it could be a wide variety of possibilities).

The UClass class inherits from UStruct which is the object which handles the class hierarchy.

UStruct::GetSuperClass() is the function which will give you the parent class, that is, parent UStruct.

Cf Class.h:

UClass* GetSuperClass() const
{
return (UClass*)GetSuperStruct();
}

Hello! This can be already done with typedefs like Super that are generated by Build Tools. You can do smth like this

	UE_LOG(LogTemp, Warning, TEXT("%s => %s => %s"), *GetClass()->GetName(), *Super::StaticClass()->GetName(), *FString(""))

Hello, I understand it can be done with code, but I meant there should be a blueprint node for this, there doesn’t seem to be one

1 Like