← ClaudeAtlas

unity-multiplayer-habitslisted

Build multiplayer correctly in a Unity project using Mirror: let the server own game state and the client own its own movement, pick the right direction for every remote call, re-validate anything a client sends, register spawnable prefabs so they actually appear, branch on the right identity flag, and never call it done without two clients agreeing. Settles which networking framework a project uses before any networked code exists. Use when: adding or changing networked behaviour, "sync this across clients", "why does this only work for the host", "it works in the editor but the other player sees nothing", "my prefab doesn't spawn for clients", `[Command]`, `[ClientRpc]`, `[SyncVar]`, `NetworkBehaviour`, Mirror, "test with two clients", or "/unity-multiplayer-habits".
Xenoneqq/unity-ai-skills · ★ 1 · Code & Development · score 74
Install: claude install-skill Xenoneqq/unity-ai-skills
# Unity multiplayer habits Two rules about who decides what. Everything below is how to keep them. **The server owns game state.** Health, inventory, score, loot, doors, who died, what spawned. The server decides and tells clients. A client *asks*; it does not announce. This is the part a cheater profits from forging, so this is the part the server keeps. **The client owns its own body.** Player movement is the standard exception, and client-authoritative is the default to reach for: server-authoritative movement only feels good once you have client-side prediction *and* server reconciliation, and without them every input waits a full round trip. Mirror agrees — `NetworkTransformBase.Reset()` sets `syncDirection = SyncDirection.ClientToServer`, so a freshly added NetworkTransform is client-authoritative out of the box. It is the developer's call, not this skill's: if the project already chose otherwise, that choice wins. Correctness first, because these bugs are the expensive kind. They reproduce only with two clients and they fail *silently* — no exception, no warning, just two screens that disagree. ## 0. Before any of this: which framework **If the project already networks, that decision is made.** Follow it. Never introduce a second networking stack alongside an existing one — they fight over the same lifecycle and nothing survives the merge. ```bash ls -d "$ROOT/Assets/Mirror" 2>/dev/null # Mirror, vendored under Assets grep -n 'netcode.gameo