Download

Add GetSuperClass as a blueprint node

Hi! It would be really convenient if there was a built-in node for getting the parent class of another class. I’m kind of surprised that this node doesn’t exist already. Thank you for reading :3

doesnt make sense in a OOP way of thinking.

Just curious : What would be a possible use case for this?
If you have an object, you as the programmer already know what parent class it should have.If you want to know whether something is of a certain super class you can use casts or use the “Class Is Child Of”-Node.

That being said, if there is a proper use case for getting the parent class, i’m all for it, but i can’t think of any.

Yeah, you could use that node, but I don’t think it’s as flexible or convenient as a GetSuperClass would be. Either way, it’s just a suggestion to add a little convenience.

https://api.unrealengine.com/INT/API…***/index.html

Create a Blueprint Function Library in C++ and add this:

.H:



UFUNCTION(Category = "Class", BlueprintPure, meta = (WorldContext = "Context", DisplayName = "Get Parent Class"))
static UClass* GetParentClass(UObject* Context);


.CPP:



UClass* UMyFunctionLibrary::GetParentClass(UObject* Context) {

    if (Context==nullptr) {return nullptr;}

    return Context->GetClass()->GetSuperClass();

}