if (HitResult.Actor->GetClass()->ImplementsInterface(UInteractableInterface::StaticClass()))
{
if (IInteractableInterface::Execute_CanInteract(HitResult.Actor, this)) // <<< error here
{
IInteractableInterface::Execute_Interact(HitResult.Actor, this); // <<< same error here
}
…
Gives an error on the “HitResult.Actor” saying:
error C2664: ‘bool
IInteractableInterface::Execute_CanInteract(UObject
*,APlayerCharacter *)’: cannot convert argument 1 from ‘AActor’ to ‘UObject
*’
I don’t understand that error. I must call the interface function on HitResult.Actor. So I gotta pass it as the parameter I suppose. But I am supposed to cast it to something before passing it or?
I also tried casting it but that resulted in more complex errors:
if (IInteractableInterface::Execute_CanInteract(Cast<IInteractableInterface>(HitResult.Actor), this))