MirrorLobbyKit: 4-Scene Lobby → Gameplay Template

A step-by-step guide to wiring up a Mirror-powered multiplayer shell: Splash → Main Menu → Lobby → Gameplay.

📜 Get the Script: Mirror-Lobby-Kit on GitHub

 

📂 Prerequisites & Folder Layout

Organize your project:


/Assets/
  /Scripts/
    StartupUIManager.cs
    CustomNetworkManager.cs
    NetworkPlayer.cs
    PlayerLobbyUIEntry.cs
    GameplayPlayer.cs
    GameplayPlayerUIEntry.cs
    GameplayUIManager.cs
  /Prefabs/
    NetworkPlayer.prefab
    PlayerLobbyUIEntry.prefab
    GameplayPlayer.prefab
    GameplayPlayerUIEntry.prefab
  /Scenes/
    Splash.unity
    MainMenu.unity
    Lobby.unity
    Gameplay.unity
    

1️⃣ Startup & Main Menu (StartupUIManager.cs)

Wire up: Add three TMP InputFields + two Buttons to your Canvas and assign them in the Inspector.


2️⃣ Network Flow & Scene Management (CustomNetworkManager.cs)

Wire up: In Splash scene, add `CustomNetworkManager`, assign your scenes + prefabs in the Inspector.


3️⃣ Persistent Player Data (NetworkPlayer.cs)

Wire up: Create `NetworkPlayer.prefab` with a `NetworkIdentity` + this script; assign `lobbyRowPrefab`.


4️⃣ Lobby UI Row (PlayerLobbyUIEntry.cs)

Wire up: Build a prefab with `TMP_Text`, `Image`, `Button`, attach this script, then assign it in `NetworkPlayer`.


5️⃣ Gameplay UI & Rows

a) GameplayPlayer (GameplayPlayer.cs)

A minimal network avatar in the Gameplay scene with just a synced `playerName`.

b) GameplayPlayerUIEntry (GameplayPlayerUIEntry.cs)

c) GameplayUIManager (GameplayUIManager.cs)

Wire up: In your Gameplay Canvas assign `backToLobbyBtn`, `playerListParent`, and `playerEntryPrefab`.


🚀 Running & Extending

  1. 🔨 Build & Run two instances:
    • Host: Main Menu → Start Host → see yourself in Lobby
    • Client: Enter IP + port → Join → appear in Lobby
  2. ✅ Client “Ready” + Host “Start” → everyone loads Gameplay
  3. 🔙 “Back to Lobby” returns all players cleanly

💡 Pro Tips & Next Steps