Service

The Network Service subsystem manages the full multiplayer service lifecycle: connecting to a backend (Unity Gaming Services, Steam, etc.), authenticating users, creating and joining sessions, and tearing down connections. It acts as the high-level orchestrator between the NetworkManager, transport-specific service adapters, and network sessions.

Architecture

spinner

Data Flow

spinner

Key Concepts

Concept
Description

NetworkService

Orchestrates the full multiplayer lifecycle: connect → sign in → session → disconnect. Owned by NetworkManager.

NetworkServiceType

Enum selecting which backend platform to use (Unity, Steam, Epic).

NetworkUser

Immutable record representing an authenticated user with an ID and display Name.

PlayerJoinedMessage

Network message broadcast by the host when a new player joins the session.

PlayerLeftMessage

Network message broadcast by the host when a player leaves the session.

SynchronizationMessage

Network message sent from host to a newly connected client containing the full player list.

Service Lifecycle

  1. ConnectNetworkService.Connect() creates an IServiceAdapter for the chosen platform and sets up the matching NetworkTransport on the Netcode NetworkManager.

  2. Sign InNetworkService.SignIn() authenticates anonymously via the adapter, producing a NetworkUser that is packed into ConnectionData.

  3. SessionQuickStart() queries for existing sessions and joins the first one found, or creates a new one if none exist. CreateSession() and JoinSession() are also available directly.

  4. Player Sync — When a new client connects, the host sends a SynchronizationMessage with the full player list, then broadcasts a PlayerJoinedMessage to all other clients.

  5. DisconnectLeaveSession() exits the session, SignOut() deauthenticates, and Disconnect() tears down the transport layer.

  6. ShutdownShutdown() performs all teardown steps in order (session → sign out → disconnect).

Classes

Class
Description

High-level multiplayer service orchestrator

Enum for selecting the network backend platform

Authenticated user identity record

Network message for player join events

Network message for player leave events

Network message for initial player list synchronization

See Also

Last updated