It’s one of those things that’s probably really simple but my brain just isn’t seeing it right now.
I’ve created an item class based off of AActor. I’ve created a C++ subclass from this item class but want to be able to access the components on the base class.
Here’s my code:
if (UClass* ParentClass = StaticClass()->GetSuperClass())
{
UE_LOG(LogTemp, Warning, TEXT(“Banana Parent Class is %s”), ParentClass->GetName())
if (AHDItems* ParentActor = Cast<AHDItems>(ParentClass))
{
ParentActor->ItemMesh->SetCollisionResponseToAllChannels(ECR_Overlap);
UE_LOG(LogTemp, Warning, TEXT(“Banana Succesfully got parent class for %s”), *GetName());
}
else
{
UE_LOG(LogTemp, Warning, TEXT(“Banana Failed to get parent class for %s”), *GetName());
}
}
ParentClass is correctly being set but the cast is failing. I just don’t know why. I hope someone can help.