Join codes
Join codes are player-shared codes that allow players to group together into a logical game session. Players can share these codes anyway they want, such as through a Lobby, in-game chat, or an outside method such as chat service.
The join codes are case insensitive, simple, and short. This makes them easy to share, such as in situations where copy and pasting isn't available.
After a host player creates a game session, they then request a join code from the Allocations service to send to their friends. Their friends can then use the join code to join the host player's game session with their game client. The Relay service handles the networking and authentication behind the scenes.
Allocations and join codes are valid for as long as the host player is connected to the Relay server. If the host player disconnects from the Relay server, or if the connection times out, the allocation and join code become invalid. There is no way to explicitly invalidate a join code.
Join codes are scoped to the Unity project ID of the player who created it. This player is typically the host player. Because join codes are designed for players to share them out-of-band, any player with the join code can join the game, even if they're anonymous.
Note: Check out Allocating, binding, and joining.
Generate a join code
You can generate a join code as the host player either with the Relay SDK or directly via the Relay API.
If you’re using Relay with Netcode for GameObjects (NGO), check out Configure the transport and start NGO as a host player.
If you’re using Relay with UTP, check out Create an allocation and request a join code.
Use a join code to join a game
You can use a join code to join a Relay server as a joining player with the Relay SDK or the Relay API.
If you’re using Relay with Netcode for GameObjects (NGO), check out Join an allocation (NGO).
If you’re using Relay with UTP, check out Join an allocation (UTP).