unity-netcode-design

Provides source-anchored design rules for Netcode for GameObjects 2.x multiplayer code.

Updated Aug 18, 2026
One-click install
npx skills add https://github.com/ethanJPope/Our-Main-Hackathon-Game --skill unity-netcode-design-ethanjpope
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: unity-netcode-design
Source: https://github.com/ethanJPope/Our-Main-Hackathon-Game/tree/main/.agents/skills/unity-skills/skills/netcode-design
Command: npx skills add https://github.com/ethanJPope/Our-Main-Hackathon-Game --skill unity-netcode-design-ethanjpope

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing Unity multiplayer code with Netcode for GameObjects often leads to subtle bugs: RPCs with wrong naming, NetworkVariables initialized too late, client-side spawn attempts, and scene sync failures. This Skill provides design rules distilled directly from the com.unity.netcode.gameobjects 2.x source code, each citing a concrete file and line so every rule is auditable. ## Core Features & Use Cases - Critical Rule Summary: Ten must-know rules covering Spawn authority, OnNetworkSpawn ordering, RPC naming constraints, prefab registration, and NetworkVariable type constraints. - Topical Reference Docs: Eight focused sub-documents covering lifecycle, ownership and authority, RPC semantics, NetworkVariable/NetworkList, spawning and prefab registration, scene management, transport configuration, and a 30-item pitfalls checklist. - Use Case: Before writing a NetworkBehaviour with RPCs and NetworkVariables, load this module to verify callback ordering, choose the correct SendTo target, and avoid the most common AI-generated netcode mistakes. ## Quick Start Load the unity-netcode-design skill before writing or reviewing any Unity multiplayer code that uses NetworkBehaviour, RPCs, NetworkVariables, or NetworkSceneManager.

Frequently Asked Questions about unity-netcode-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I correctly spawn a NetworkObject in Netcode for GameObjects?

Only the Server or Host may call Spawn, Despawn, or ChangeOwnership on a NetworkObject. Clients must send a [Rpc(SendTo.Server)] request and let the server call Instantiate plus Spawn, or use NetworkSpawnManager.InstantiateAndSpawn for a one-shot spawn.

What is the difference between OnNetworkSpawn and Start in Netcode for GameObjects?

OnNetworkSpawn runs after Awake and OnEnable but before Unity's Start, and it is the first point where IsSpawned, IsOwner, and IsServer are valid. Network state initialization belongs in OnNetworkSpawn, never in Awake or Start.

Why does my ServerRpc fail to compile in Netcode for GameObjects?

Legacy [ServerRpc] methods must end with the suffix ServerRpc and [ClientRpc] methods must end with ClientRpc, enforced by ILPP at compile time. Switching to the universal [Rpc(SendTo.Server)] attribute removes the naming constraint entirely.

Can I use NetworkVariable with string or List types in Unity Netcode?

No, NetworkVariable requires T to be unmanaged or implement INetworkSerializable, so string and List are rejected at compile time. Use FixedString32Bytes for text and NetworkList<T> for replicated collections instead.

Does Netcode for GameObjects 2.x support distributed authority?

Yes, setting NetworkConfig.NetworkTopology to DistributedAuthority removes the dedicated server role and gives each NetworkObject its own authority. Use SendTo.Authority instead of SendTo.Server, and owners may write NetworkVariables on objects they own.

Why do clients not follow when I change scenes in Unity Netcode?

Calling UnityEngine.SceneManagement.SceneManager.LoadScene only switches the local peer's scene. The server must call NetworkManager.SceneManager.LoadScene so all clients receive the scene event and synchronize automatically.