hey guys i have got a problem in logging out the name of things that I hit if I hit something its okay but if I don’t and still try to log out the name of the actor that was hit it will result in a crash how do I fix it?
AController* OwnerContrller = OwnerPawn->GetController();
FVector End = Location + Rotation.Vector() * CastingRange;
GetWorld()->LineTraceSingleByChannel(Hit, Location, End, ECollisionChannel::ECC_Visibility, Params);
DrawDebugLine(GetWorld(), Location, End, FColor::Red, false, 5.f);
FString HitName = Hit.GetActor()->GetName();
UE_LOG(LogTemp, Warning, TEXT(“The component name %s”), *HitName);