I’m working on a fps and took some weapon code from the shooter game but I’ve run into a very strange issue where a function is getting called but it never gets executed. Here’s what’s happening, my code calls ServerNotifyHit but ServerNotifyHit_Implementation never gets fired.
this is the function declaration
/** server notified of hit from client to verify */
UFUNCTION(reliable, server, WithValidation)
void ServerNotifyHit(const FHitResult Impact, FVector_NetQuantizeNormal ShootDir, int32 RandomSeed, float ReticleSpread);
and here’s where it tries to call the function. I used breakpoints and am using an onscreeen debug msg so i know for sure that its getting to the point where it tries to call ServerNotifyHit
void Aweapon_pistol::ProcessInstantHit(const FHitResult& Impact, const FVector& Origin, const FVector& ShootDir, int32 RandomSeed, float ReticleSpread)
{
if (MyPawn && MyPawn->IsLocallyControlled() && GetNetMode() == NM_Client)
{
// if we're a client and we've hit something that is being controlled by the server
if (Impact.GetActor() && Impact.GetActor()->GetRemoteRole() == ROLE_Authority)
{
// notify the server of the hit
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString("trying to call ServerNotifyHit()"));
ServerNotifyHit(Impact, ShootDir, RandomSeed, ReticleSpread);
}