Identifier is undefined

i’m trying to cast my aicharacter to hit.getactor but i keep getting this error identifier “Hit” is undefined and for my if statment if my hit.getactor is true then i can apply damage (damageamount) and i get the same error and i’m apply damage to my linetrace

HordeCharacter.cpp

void AHordeCharacter::OnFire()
{

	
	
	AAI_Character* character = Cast<AAI_Character>(Hit.GetActor);


	FHitResult Hit(ForceInit);
	
	FVector start = FP_Gun->GetForwardVector();
	FVector End = start + (FP_Gun->GetForwardVector()* 700.f);
	FCollisionQueryParams CollisionParams;
	FVector Start = FP_Gun->GetComponentLocation();

	DrawDebugLine(GetWorld(), Start, End, FColor::Green, true, 2.f, false, 4.f);

	GetWorld()->LineTraceSingleByChannel(Hit, start, End, ECC_WorldDynamic, CollisionParams);


	if (Hit.GetActor)
	{
		character->damage(damageamount);
	}
	


}

AI character.h
health = 5.f;
damageamount = 2.f;

void AAI_Character::damage(float damageamount)
{
	health = health - damageamount;
}

Hit is indeed undefined at line 6. You need to prepare the Hit struct before you use it like with the Line Trace.

thank you the hit is identified but how do i fix the problem with the damageamount i got my AI character .h file in there but it keeps coming up

If you fix Hit.GetActor then the Character will no longer be NULL and in turn that should fix the call to damage.

thank you everything works but my damageamount still has the error

Please be specific. What is the error?