Updated Interaction.cpp to fix certain crashes

This commit is contained in:
MARCEL HARA 2023-04-27 17:19:01 +01:00
parent dd1ab03357
commit 38caa46e58

View File

@ -25,8 +25,8 @@ void AInteraction::BeginPlay()
Super::BeginPlay();
//Character & Camera refs
TempCharacterRef = Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetCharacter());
MainCamera = Cast<UCameraComponent>(TempCharacterRef->FindComponentByClass<UCameraComponent>());
if (TempCharacterRef != nullptr) TempCharacterRef = Cast<ATempCharacter>(GetWorld()->GetFirstPlayerController()->GetCharacter());
if (MainCamera != nullptr) MainCamera = Cast<UCameraComponent>(TempCharacterRef->FindComponentByClass<UCameraComponent>());
//Item refs
TargetHealingLocation = HealingItem->GetActorLocation();