For some reason the code snippit below is causing a crash when looking at or walking through spawned actors.
if (!MenuVisible)
{
PHelpText = "";
FHitResult* HitRes = new FHitResult();
FVector HitStart = FPC->GetComponentLocation();
FVector FwdVect = FPC->GetForwardVector();
FVector HitEnd = ((FwdVect * ReachRadius) + HitStart);
FCollisionQueryParams* ColQueryParams = new FCollisionQueryParams();
ColQueryParams->AddIgnoredActor(this);
//ColQueryParams->AddIgnoredActor(TestTarget)
if (GetWorld()->LineTraceSingleByChannel(*HitRes, HitStart, HitEnd, ECC_Visibility, *ColQueryParams))
{
//DrawDebugLine(GetWorld(), HitStart, HitEnd, FColor::Emerald, false, 5.5f);
AInteractable* IntObj = Cast<AInteractable>(HitRes->Actor.Get());
PHelpText = IntObj->IntHelpString;
}
}
Granted probably not the most efficient way to do this but it works for the time being, and this is in the tick function.