Messages
Network-serializable message structs used by NetworkSession to synchronize player state across clients. All messages implement INetworkSerializable from Unity Netcode and manually serialize NetworkPlayer data (user ID, user name, client ID) via FastBufferWriter/FastBufferReader.
Architecture
Message Flow
When a new client connects:
The host sends a
SynchronizationMessageto the new client with the full current player list.The host broadcasts a
PlayerJoinedMessageto all existing clients.
When a client disconnects:
The host broadcasts a
PlayerLeftMessageto all remaining clients.
Serialization Format
All messages manually serialize NetworkPlayer fields in the same order:
UserID
string
The user's service identity
UserName
string
The user's display name
ClientID
ulong
The Netcode client connection ID
On deserialization, a new NetworkPlayer is reconstructed from a NetworkUser and the NetworkClient looked up from NetworkManager.API.ConnectedClients.
Classes
Broadcast when a player joins the session
Broadcast when a player leaves the session
Sent to new clients with the full player list
See Also
Service — parent subsystem overview
NetworkPlayer — the player record serialized by these messages
NetworkUser — user identity reconstructed during deserialization
Last updated