Hey there, from a UInterface with a BlueprintNativeEvent, how can I get the “interfaced” AActor’s components?
I tried this, but I’m getting weird errors: “LogUObjectArray: Warning: Other object in slot”. Is there a better way?
// .h
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "Drama")
UDramaComponent* DramaComponent();
UDramaComponent* DramaComponent_Implementation();
// .cpp
UDramaComponent* IDramaActorInterface::DramaComponent_Implementation()
{
AActor* OwningActor = Cast<AActor>(_getUObject()); // ???
if (OwningActor == nullptr) return nullptr;
return Cast<UDramaComponent>(OwningActor->GetComponentByClass(UDramaComponent::StaticClass()));
}