menu_bookDocumentation

NetworkHelper — quick multiplayer setup with auto-server and player spawning

calendar_today May 5, 2026 schedule ~2 min read person patrickjr verified 50

NetworkHelper — Quick Multiplayer Setup

NetworkHelper is a built-in s&box component that handles the boilerplate of starting a server and spawning players. It's the fastest way to get a multiplayer scene running and serves as a reference for building your own network manager.

What It Does

  • Automatically starts a server when the scene loads (if StartServer is enabled and no network session is already active)
  • Spawns a player prefab for each connecting client
  • Supports a list of SpawnPoint GameObjects for spawn locations
  • Implements Component.INetworkListener internally — use it as a reference for custom managers

Setup

  1. Add a NetworkHelper component to a GameObject in your scene
  2. Set PlayerPrefab to your player prefab
  3. Optionally add SpawnPoint GameObjects and assign them to the SpawnPoints list
  4. Enable StartServer to auto-host on scene load

Player Prefab Pattern

Your player prefab should check IsProxy to skip input processing on remote clients:

CSHARP
public sealed class PlayerController : Component
{
    [RequireComponent] CharacterController Controller { get; set; }

    protected override void OnUpdate()
    {
        // IsProxy = true means this instance is owned by another client
        if ( IsProxy ) return;

        var move = new Vector3( Input.AnalogMove.x, Input.AnalogMove.y, 0 );
        Controller.Velocity = move.Normal * 200f;
        Controller.Move();
    }
}

Under the Hood

NetworkHelper implements Component.INetworkListener.OnActive( Connection channel ) — when a client connects, it clones the PlayerPrefab and calls GameObject.NetworkSpawn( channel ) to assign ownership. You can replicate this pattern in a custom GameManager for full control.

Custom Network Manager

For games that need more control (team assignment, lobby logic, reconnection), implement INetworkListener directly:

CSHARP
public sealed class GameManager : GameObjectSystem<GameManager>, Component.INetworkListener
{
    void Component.INetworkListener.OnActive( Connection channel )
    {
        var player = PlayerPrefab.Clone( FindSpawnPoint() );
        player.NetworkSpawn( channel );
    }

    void Component.INetworkListener.OnDisconnected( Connection channel )
    {
        // Clean up player object
        var player = Scene.GetAll<PlayerController>()
            .FirstOrDefault( p => p.Network.Owner == channel );
        player?.GameObject.Destroy();
    }
}
Was this helpful?