Four players, four spawners, all spawning.

The problem
Every machine runs the scene.
TimeUntil _nextWave; protected override void OnUpdate(){ if ( _nextWave > 0 ) return; SpawnWave(); // clones and NetworkSpawns _nextWave = 30;}
The spawner is part of the scene, so every machine has one, and each one sends out a wave.
The fix
The host runs the rules.
Game rules run on one machine, the host. Everyone else gets the results over the network.
host→runs the rules
everyone else→sees the result
The fix in code
Return unless you're the host.
protected override void OnUpdate(){ if ( !Networking.IsHost ) return; if ( _nextWave > 0 ) return; SpawnWave(); _nextWave = 30;}
IsHost is also true with no network at all, so testing alone still works. Our crowd code opens with the same guard.
Watch out
The host's work has to be shared.
Clients only see what the host sends them.
- Spawned objects
- NetworkSpawn()
- Scores, timers
- SyncFlags.FromHost
- A sound, a spark
- [Rpc.Broadcast]
The rule
Game rules run on the host.
- Spawning, scores, timers
- the host
- Everyone else
- sees the result
- The guard
- if ( !Networking.IsHost )