Hello! I am trying to make my character interact with a NPC character i created. I have created the interaction interface class in c++ and declared a interactvoid() function of type void. In my character class i have this code, but unreal crashes when i try to run it. What am i doing wrong?
void AQuestSystemCharacter::OnSphereOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
ANPCCharacter* Character = Cast(OtherActor);
if (Character && Character->GetClass()->ImplementsInterface(UIInteractionInterface::StaticClass()))
{
IIInteractionInterface::Execute_InteractVoid(OtherActor);
}
}
void AQuestSystemCharacter::InteractVoid_Implementation()
{
if (GEngine)
{
GEngine->AddOnScreenDebugMessage(-1, 2, FColor::Red, “interacted”);
}
}