AnimMontage Replication on Player Pawn From Weapon

Hey All.

I’ve been facing a kind of a weird problem for about a week while working on Tom Looman’s c++ example.

I have a player pawn class (SCharacter) derived from SBaseCharacter which derived from ACharacter. And a weapon class which derived from Actor class.

My problem is, when i call “PlayAnimMontage” on player pawn from weapon class, it is not replicated to the clients when running on dedicated server.

Clients can see their own animations.

Clients cant see others fire animations.

Both Player and Weapon classes are replicated.

Here is my code on SCharacter class and header;

UFUNCTION(NetMulticast, Reliable)
void MulticastSetFiring(UAnimMontage* FireAnimation);

UFUNCTION(Server, Reliable, WithValidation)
void ServerSetFiring(UAnimMontage* FireAnimation);

UFUNCTION()
void SetFiring(UAnimMontage* FireAnimation);

void PlayFireAnimation(UAnimMontage* FireAnimation);


void ASCharacter::MulticastSetFiring_Implementation(UAnimMontage* FireAnimation)
{
	SetFiring(FireAnimation);
}

void ASCharacter::ServerSetFiring_Implementation(UAnimMontage* FireAnimation)
{
	MulticastSetFiring(FireAnimation);
}

bool ASCharacter::ServerSetFiring_Validate(UAnimMontage* FireAnimation)
{
	return true;
}

void ASCharacter::PlayFireAnimation(UAnimMontage* FireAnimation)
{
	if (Role == ROLE_Authority)
	{
		SetFiring(FireAnimation);
	}
	else 
	{
		ServerSetFiring(FireAnimation);
	}
}
 
void ASCharacter::SetFiring(UAnimMontage* FireAnimation)
{
	// try and play a firing animation if specified
	if (FireAnimation != NULL)
	{
		GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, FString::Printf(TEXT("SetFiring")));
		Super::PlayAnimMontage(FireAnimation, 1.f);
	}
}

From my weapon class, i simple calling;

void ASWeapon::PlayAnimationOnPlayer(UAnimMontage* Animation, float InPlayRate, FName StartSectionName)
{
	if (MyPawn)
	{
		if (Animation)
		{
			MyPawn->PlayFireAnimation(Animation);
		}
	}
} 

Any Suggestions?

Thanks.

I’ve solved it.

It is seriously strange but;

I’ve two slots for animation montage blending, “UpperBody” and “FiringBody”.

My Anim montages was set to play on “FiringBody” which i created for weapon fire blends. I’ve changed it to “UpperBody” then it started replicating to the clients.

I guess it has already been replicated but animation not played on “FiringBody” slot on other clients.