Hi All
I’m doing a multiplayer shooter game. I’m having a problem in playing my Animation Montage. The Animation montage is not playing in the client side. In the server side if I press a button for suicide in the server side the death Animation montage is playing properly even if I press from the client if I press button the suicide death Animation montage for client is playing in the server side. But in the Client Side if I press button the death Animation montage is not playing on both sides. I’ll show my code also please check if I did any mistake.
In the characer.h file code:
public:
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = “DeathAnimation”)
class UAnimMontage *DeathMontage;
void OnDeath();
protected:
UFUNCTION(reliable, Server, WithValidation)
void ServerOnDeath();
Character.cpp code:
void APamajCharacter::OnDeath()
{
if (DeathMontage)
{
if (Role < ROLE_Authority)
{
ServerOnDeath();
}
else
{
float AnimTime = PlayAnimMontage(DeathMontage);
}
}
GEngine->AddOnScreenDebugMessage(-1, 5, FColor::Cyan, "OnDeathFn is called");
}
void APamajCharacter::ServerOnDeath_Implementation()
{
OnDeath();
}
bool APamajCharacter::ServerOnDeath_Validate()
{
return true;
}
Thanks&Regards
Programmer