Im trying to bind a function to a box trigger that the level script has a reference to.
in the .h
ALevelTrigger* LevelTrigger;
UFUNCTION()
void BeginOverlap(AActor* OverlappedActor, AActor* OtherActor);
begin overlap implementation
void ALevelOneScriptActor::BeginOverlap(AActor* OverlappedActor, AActor* OtherActor)
{
UE_LOG(LogTemp, Warning, TEXT("OverlappedActor: %s"), *OverlappedActor->GetName());
UE_LOG(LogTemp, Warning, TEXT("OtherActor: %s"), *OtherActor->GetName());
}
in BeginPlay in level script cpp
LevelTrigger->OnActorBeginOverlap.AddDynamic(this, &ALevelOneScriptActor::BeginOverlap);
This causes a crash and error which points me to this line
check(DelegateOwner->IsValidLowLevelFast(false)); // Most likely the delegate is trying to be used on the stack, in an object it wasn't defined for, or for a class member with a different name than it was defined for. It is only valid for a sparse delegate to be used for the exact class/property name it is defined with.
This seems to mean i cant use ALevelOneScriptActor as a delegate although this seems like a pretty standard thing to do so i dont know what im doing wrong.
Thanks in advance!