Skip to content

Netcode for GameObjects transport

Namespace: BlitzRelay.Ngo

Component: BlitzRelayTransport

Requires Unity 6000.0 or later and Netcode for GameObjects 2.13.0.

Field Default Purpose
Relay Address 127.0.0.1 Relay hostname or IP address.
Relay Port 7770 Relay UDP port.
Relay Key Empty Must match BLITZ_RELAY_CONNECTION_KEY.
Room Code Empty Room to join or claim; assigned automatically to a new host.
Do Not Route Off Sets LiteNetLib’s socket DontRoute option.
Maximum Clients 4096 Requested room client limit, constrained in the Inspector to 1–8192.
Disconnect Timeout Milliseconds 30000 LiteNetLib inactivity timeout.

The transport uses an MTU override of 1,350 bytes.

Member Meaning
ServerClientId Always 0.
IsRelayHostAvailable Whether the room currently has an active relay host.
HasPendingHostPromotion Whether a promotion claim is stored for the next server start.
OnRelayHostAvailabilityChanged Raised when host availability changes.
OnHostPromotionReceived Raised with HostPromotion when this client is selected as the next host.
ServerSocket / ClientSocket The transport’s relay sockets and their current state.
Member Purpose
GetRelayAddress() / SetRelayAddress(string) Read or replace the relay address.
GetRelayPort() / SetRelayPort(ushort) Read or replace the relay UDP port.
GetRelayKey() / SetRelayKey(string) Read or replace the relay connection key.
GetRoomCode() / SetRoomCode(string) Read the assigned code or select a room before StartClient().
GetRoomHostToken() / SetRoomHostToken(string) Read or replace the token returned when the server claims a room.
GetMaximumClients() / SetMaximumClients(int) Read or replace the requested room limit.
ClearPendingHostPromotion() Discard the stored promotion claim. A later server start creates a new ephemeral room instead of claiming the persistent room.
NGO delivery Relay delivery
Unreliable Unreliable
UnreliableSequenced Unreliable
Every other NetworkDelivery value Reliable ordered

Oversized unreliable payloads are dropped. Reliable payloads larger than one LiteNetLib packet are sent through LiteNetLib fragmentation.

The transport acknowledges HostPromoted, stores the room code, maximum clients, and claim token, then raises OnHostPromotionReceived. Game code must shut down the NGO client and start server or host mode. See Handle host migration.