Ok. So I know this title is a little weird, but let me explain. So I tried using a casting method to cast from Character to a derivative of Character. I kept getting a crash due to failed casting, so I removed it, and still getting the same crash. So I need to know how to “update” my project to fix this, because I tried compiling it and it still thinks theres an issue.
void AMyDoor::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
AMyPlayerCharacter* Character = NewObject<AMyPlayerCharacter>(this);
UGameplayStatics::GetPlayerPawn(Character, 0);
FVector ThisPosition = GetActorLocation();
FVector PlayerPosition = Character->GetActorLocation();
float Dist = FVector::Dist(PlayerPosition, ThisPosition);
if (Dist <= BuyDistance)
{
Character->bIsNearDoor = true;
}
else
{
Character->bIsNearDoor = false;
}
}