When I try to destroy my enemy ai it doesn’t sync to all players on the player that shoots the enemy sees the enemy die
I’ve tried syncing making it destroy the object on the player that has the network authority but Whenever I try it says there’s no network authority
And I’ve tried just launching the commands on the enemy by itself but that only shows on the player that kills the enemy
My enemy ai Code:
public void takeDamage(int __amount) {
if (isDead)
return;
enemyHealth -= __amount;
if (enemyHealth <= 0) {
die();
}
}
public void die()
{
//GameObject rg = (GameObject)Instantiate(ragDoll, transform.position, Quaternion.identity);
//GameObject bS = (GameObject)Instantiate(bloodSplatter, transform.position, Quaternion.identity);
//enemyGFX.SetActive(false);
//isDead = true;
CmdEnemyOnDie();
}
[Command]
public void CmdEnemyOnDie()
{
RpcEnemyOnDie();
}
[ClientRpc]
private void RpcEnemyOnDie()
{
GameObject rg1 = (GameObject)Instantiate(ragDoll, transform.position, Quaternion.identity);
Destroy(rg1, 60);
Destroy(enemyGFX);
}
}