public class Player : NetworkBehaviour
void CmdMagic(GameObject target, int damage)
target.GetComponent<Player>().health -= damage;
NetworkIdentity opponentIdentity = target.GetComponent<NetworkIdentity>();
TargetDoMagic(opponentIdentity.connectionToClient, damage);
public void TargetDoMagic(NetworkConnection target, int damage)
// This will appear on the opponent's client, not the attacking player's
Debug.Log(quot;Magic Damage = {damage}");
public void TargetHealed(int amount)
// No NetworkConnection parameter, so it goes to owner
Debug.Log(quot;Health increased by {amount}");