Hello.
I’m making enemies using different equipment that works on the listen server.
Enemy characters are sponged without equipment.
After that, spawn and equip the set equipment.
On the server, the animation is applied normally.
However, it does not apply to the client.
Here’s my code.
===.h===
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, ReplicatedUsing = OnRep_MakeWeapon1)
TSubclassOf<class UAnimInstance> weapon1AnimInst;
===.cpp===
void ABaseEnemy::MakeWeapon1(FName newWeapon)
{
SetOwner(GetWorld()->GetFirstPlayerController());
ServerRPC_MakeWeapon1(newWeapon);
}
void ABaseEnemy::ServerRPC_MakeWeapon1_Implementation(FName newWeapon)
{
weapon1RowName = newWeapon;
//gi is Game Instance
if (gi)
{
FweaponSpec* weaponData = gi->DT_Weapon1Data->FindRow<FweaponSpec>(weapon1RowName, "");
if (weaponData)
{
weapon1 = GetWorld()->SpawnActor<ABaseWeapon>(weaponData->shape);
if (weapon1)
{
weapon1AnimInst = weaponData->anim;
OnRep_MakeWeapon1();
}
}
}
}
void ABaseEnemy::OnRep_MakeWeapon1()
{
GetMesh()->SetAnimationMode(EAnimationMode::AnimationBlueprint);
GetMesh()->SetAnimInstanceClass(weapon1AnimInst);
}
How can I change my client’s animation blueprint?