Network Health

Network Health syncs a Health from the server to the clients. Place it on the root of a network prefab, next to its Health.

Note

Turn off Destroy On Death on the Health. A spawned network object must be despawned by the server, which this component does.

✅ Ideal For

  • Players and enemies in multiplayer
  • PvP, where clients must not decide hits

📐 Inspector Overview

FieldDescription
Despawn On DeathDespawns the object on every machine when it dies on the server. Turn it off to keep the object, for example to respawn it in place

⚙️ How It Works

  flowchart LR
    H["Server Health"] -->|"health value"| N["Network Health"]
    N --> C["Client Health"]
    H -->|"dies"| D["Clients die, then despawn"]
  • On the server, every health change is sent to the clients.
  • On clients, it adds an Invincibility so their own hits do no damage. They still show impacts and hit effects.
  • Clients apply the server’s value to their Health, so On Health Changed still fires there and health bars update.
  • When the object dies on the server, the clients kill their copy first, so death effects play, then the server despawns it if Despawn On Death is on.