C# for Unity: Coroutines & Multiplayer Networking

Lesson 7 of 7

Final Project: Networked Countdown Spawner

Combine everything from this course into one networked feature.

Requirements

  1. Create a networked prefab (NetworkObject + a NetworkBehaviour script) representing an enemy spawner.
  2. On the server, run a coroutine that counts down from 5 seconds using WaitForSeconds, syncing the remaining time to clients through a NetworkVariable<float>.
  3. When the countdown reaches zero, the server should spawn an enemy prefab (Instantiate + NetworkObject.Spawn()) and restart the countdown.
  4. Expose a [ServerRpc] that lets any client request an immediate spawn (e.g. for testing), guarded so it only works before the match starts.
  5. Use a [ClientRpc] to play a sound or log a message on every client the moment an enemy spawns.

Stretch goals

  • Cap the number of enemies alive at once, checked server-side before spawning.
  • Show the synced countdown in on-screen UI using NetworkVariable.OnValueChanged.
  • Handle a client that joins mid-countdown, it should immediately see the current value, not start from zero.

Submit your repository link below when you are done, an instructor will review it before you can mark this lesson complete. Good luck! 🚀

This lesson ends in a project. Build it on your own machine, there's nowhere to submit it here, but the brief above is everything you need.