Hey guys! I’m having an issue with updating my client player. I have a non player enemy spawned into the game when the host attacks the health bar will update across both. but when client attacks i get nothing. Been on this a few days appreciate any help!(i have network identity’s with player authority on the enemys and players.)
public void TakeDamage(float amount)
{
currentHealth -= amount;
CmdUpdateHealthBar(amount);
if (currentHealth <= 0)
{
Destroy(gameObject);
}
}
[Command]
void CmdUpdateHealthBar(float amount)
{
healthBar.sizeDelta = new Vector2(currentHealth, healthBar.sizeDelta.y);
RpcUpdateHealthBarClient();
}
[ClientRpc]
void RpcUpdateHealthBarClient()
{
healthBar.sizeDelta = new Vector2(currentHealth, healthBar.sizeDelta.y);
}