<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mindattic.com/wiki/docs/index.php?action=history&amp;feed=atom&amp;title=Unity.Multiplayer%2Farticles%2Fjoin-codes</id>
	<title>Unity.Multiplayer/articles/join-codes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mindattic.com/wiki/docs/index.php?action=history&amp;feed=atom&amp;title=Unity.Multiplayer%2Farticles%2Fjoin-codes"/>
	<link rel="alternate" type="text/html" href="https://mindattic.com/wiki/docs/index.php?title=Unity.Multiplayer/articles/join-codes&amp;action=history"/>
	<updated>2026-12-05T06:41:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.3</generator>
	<entry>
		<id>https://mindattic.com/wiki/docs/index.php?title=Unity.Multiplayer/articles/join-codes&amp;diff=929&amp;oldid=prev</id>
		<title>Docs Sync: md2wiki: sync from MindAttic.Docs</title>
		<link rel="alternate" type="text/html" href="https://mindattic.com/wiki/docs/index.php?title=Unity.Multiplayer/articles/join-codes&amp;diff=929&amp;oldid=prev"/>
		<updated>2026-11-29T20:37:05Z</updated>

		<summary type="html">&lt;p&gt;md2wiki: sync from MindAttic.Docs&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Join codes =&lt;br /&gt;
&lt;br /&gt;
A join code is a short, typeable string that resolves to a server — &amp;lt;code&amp;gt;ABC-DEF-GHJ&amp;lt;/code&amp;gt; — so players never type an IP address. One interface, two implementations, and &amp;lt;code&amp;gt;JoinCodeProvider.Auto&amp;lt;/code&amp;gt; picks the right one for the topology.&lt;br /&gt;
&lt;br /&gt;
== The format ==&lt;br /&gt;
&lt;br /&gt;
A code is 8 data characters plus one check character, written as three groups of three (&amp;lt;code&amp;gt;ABC-DEF-GHJ&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strong&amp;gt;Alphabet:&amp;lt;/strong&amp;gt; &amp;lt;code&amp;gt;23456789ABCDEFGHJKLMNPQRSTUVWXYZ&amp;lt;/code&amp;gt; — 32 symbols, 5 bits each, 40 bits of data. It never contains &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;O&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;I&amp;lt;/code&amp;gt;, so nothing in a code is ambiguous to read aloud or copy down.&lt;br /&gt;
* &amp;lt;strong&amp;gt;Check character:&amp;lt;/strong&amp;gt; a Damm check over GF(32). It catches every single-character substitution and every swap of two characters next to each other or one apart, anywhere in the code, the check character included.&lt;br /&gt;
* &amp;lt;strong&amp;gt;Typo tolerance:&amp;lt;/strong&amp;gt; parsing ignores case, whitespace, and &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;_&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; separators (and Unicode dashes). If someone types a look-alike character that can&amp;#039;t legally appear (&amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;O&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;I&amp;lt;/code&amp;gt;), the parser tries the glyphs it&amp;#039;s usually mistaken for and accepts the one the check character confirms.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;JoinCode.TryParse&amp;lt;/code&amp;gt; does all of this; a game never needs its own normalization.&lt;br /&gt;
&lt;br /&gt;
== The two providers ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!  &lt;br /&gt;
! Unity Relay&lt;br /&gt;
! Rendezvous service&lt;br /&gt;
|-&lt;br /&gt;
| Gets through home-router NAT&lt;br /&gt;
| Yes&lt;br /&gt;
| No — needs a reachable address&lt;br /&gt;
|-&lt;br /&gt;
| Needs&lt;br /&gt;
| &amp;lt;code&amp;gt;com.unity.services.multiplayer&amp;lt;/code&amp;gt; installed, project linked to a Unity Cloud project with Relay on ([[#Unity Relay for a home host (no port forwarding)|setup]])&lt;br /&gt;
| &amp;lt;code&amp;gt;NetConfig.RendezvousUrl&amp;lt;/code&amp;gt; pointed at a running &amp;lt;code&amp;gt;server/Rendezvous&amp;lt;/code&amp;gt; instance&lt;br /&gt;
|-&lt;br /&gt;
| Default for&lt;br /&gt;
| Listen server (&amp;lt;code&amp;gt;Topology.Host&amp;lt;/code&amp;gt;), when installed&lt;br /&gt;
| Dedicated server (&amp;lt;code&amp;gt;Topology.Server&amp;lt;/code&amp;gt;); a listen server without Relay&lt;br /&gt;
|-&lt;br /&gt;
| Implementation&lt;br /&gt;
| &amp;lt;code&amp;gt;RelayJoinCodeService&amp;lt;/code&amp;gt;&lt;br /&gt;
| &amp;lt;code&amp;gt;RendezvousJoinCodeService&amp;lt;/code&amp;gt; (Core, engine-free) over &amp;lt;code&amp;gt;RendezvousClient&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Both implement the same engine-free &amp;lt;code&amp;gt;IJoinCodeService&amp;lt;/code&amp;gt; contract (&amp;lt;code&amp;gt;PublishAsync&amp;lt;/code&amp;gt; → a code, &amp;lt;code&amp;gt;ResolveAsync&amp;lt;/code&amp;gt; → a target or null, idempotent &amp;lt;code&amp;gt;RevokeAsync&amp;lt;/code&amp;gt;), so a session doesn&amp;#039;t need to know which one is live.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;NetConfig.JoinCodes&amp;lt;/code&amp;gt; (or the &amp;lt;code&amp;gt;NetBootstrap&amp;lt;/code&amp;gt; Inspector field) chooses:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-csharp&amp;quot;&amp;gt;public enum JoinCodeProvider&lt;br /&gt;
{&lt;br /&gt;
    Auto,        // the topology&amp;#039;s default: Relay (else the rendezvous URL) for Host, Rendezvous for Server&lt;br /&gt;
    None,        // join by address only&lt;br /&gt;
    Relay,&lt;br /&gt;
    Rendezvous,&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;JoinCodeDefaults.ForPublishing(topology, configured)&amp;lt;/code&amp;gt; is the rule &amp;lt;code&amp;gt;Auto&amp;lt;/code&amp;gt; expands to: Relay for a Host, Rendezvous for a Server, and &amp;lt;code&amp;gt;None&amp;lt;/code&amp;gt; for a Client (a client never publishes a code). A listen server refines it with what is set up, through &amp;lt;code&amp;gt;JoinCodeDefaults.HostingOrder(configured, relayInstalled, hasRendezvousUrl)&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;Auto&amp;lt;/code&amp;gt; tries Relay first when &amp;lt;code&amp;gt;com.unity.services.multiplayer&amp;lt;/code&amp;gt; is installed, then the rendezvous service when &amp;lt;code&amp;gt;RendezvousUrl&amp;lt;/code&amp;gt; is set. &amp;lt;code&amp;gt;HostWithCode&amp;lt;/code&amp;gt; uses the first of those (&amp;lt;code&amp;gt;ForHosting&amp;lt;/code&amp;gt;), and the drop-in front end&amp;#039;s &amp;lt;strong&amp;gt;Host&amp;lt;/strong&amp;gt; tries each in turn before hosting for joining by IP. An explicit &amp;lt;code&amp;gt;Relay&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;Rendezvous&amp;lt;/code&amp;gt; is kept as chosen. A dedicated server with a rendezvous URL registers itself as soon as it&amp;#039;s &amp;lt;code&amp;gt;Running&amp;lt;/code&amp;gt;, and re-registers with a new code if the service ever forgets it (&amp;lt;code&amp;gt;RegistrationLost&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== Using it ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-csharp&amp;quot;&amp;gt;// Host: publish a code (Relay by default)&lt;br /&gt;
JoinCode code = await bootstrap.HostWithCode();&lt;br /&gt;
string text = session.PublishedCodeText; // &amp;quot;ABC-DEF-GHJ&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Client: resolve and join&lt;br /&gt;
bool joined = await bootstrap.JoinByCode(&amp;quot;abc-def-ghj&amp;quot;); // case and dashes don&amp;#039;t matter&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;JoinByCode&amp;lt;/code&amp;gt; tries the rendezvous service first when &amp;lt;code&amp;gt;RendezvousUrl&amp;lt;/code&amp;gt; is set, then Relay when the package is installed and the code is Relay-shaped (Unity Relay&amp;#039;s own 6–12 character codes are written in a subset of this alphabet, so a Relay code plus a check character is a valid join code). The transport used to connect comes from whichever registration resolves the code. &amp;lt;code&amp;gt;NetSession.JoinCodePublished&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;JoinCodeFailed&amp;lt;/code&amp;gt; report success or a message to show; a session withdraws its code when it ends.&lt;br /&gt;
&lt;br /&gt;
== Unity Relay for a home host (no port forwarding) ==&lt;br /&gt;
&lt;br /&gt;
Relay is what lets a player host from home, behind a router they can&amp;#039;t forward ports on, and still hand friends a code. It needs three things, and the package checks each one and says which is missing:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;strong&amp;gt;The package.&amp;lt;/strong&amp;gt; &amp;lt;code&amp;gt;&amp;quot;com.unity.services.multiplayer&amp;quot;: &amp;quot;2.4.1&amp;quot;&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;Packages/manifest.json&amp;lt;/code&amp;gt; (it defines &amp;lt;code&amp;gt;MINDATTIC_UGS&amp;lt;/code&amp;gt;; 2.4.1 is the version this library is verified with, &amp;lt;code&amp;gt;RelaySetup.PackageVersion&amp;lt;/code&amp;gt;).&lt;br /&gt;
# &amp;lt;strong&amp;gt;A link to a Unity Cloud project.&amp;lt;/strong&amp;gt; The project needs a cloud project id. Unity bakes it into every build, and Unity Services reads it as &amp;lt;code&amp;gt;Application.cloudProjectId&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &amp;lt;strong&amp;gt;Relay turned on&amp;lt;/strong&amp;gt; for that Cloud project at [https://cloud.unity.com/ cloud.unity.com] (the project, then &amp;lt;strong&amp;gt;Products ▸ Relay&amp;lt;/strong&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Players need no Unity account: each game signs in to Unity Authentication &amp;lt;strong&amp;gt;anonymously&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Setting it up ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;In the editor:&amp;lt;/strong&amp;gt; &amp;lt;strong&amp;gt;MindAttic ▸ Multiplayer ▸ New Game…&amp;lt;/strong&amp;gt; has a step 3, &amp;lt;em&amp;gt;Join codes without port forwarding&amp;lt;/em&amp;gt;. It shows where the project stands and has three buttons: &amp;lt;strong&amp;gt;Add com.unity.services.multiplayer&amp;lt;/strong&amp;gt;, &amp;lt;strong&amp;gt;Link project (Services settings)&amp;lt;/strong&amp;gt; (opens &amp;lt;strong&amp;gt;Edit ▸ Project Settings ▸ Services&amp;lt;/strong&amp;gt;, where you pick the organization and the Cloud project and click Link) and &amp;lt;strong&amp;gt;Unity Cloud dashboard&amp;lt;/strong&amp;gt;. &amp;lt;strong&amp;gt;MindAttic ▸ Multiplayer ▸ Check Unity Relay Setup&amp;lt;/strong&amp;gt; logs the same status at any time.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;From a script, with the editor closed:&amp;lt;/strong&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-powershell&amp;quot;&amp;gt;# Link the project and add the package (find both ids at cloud.unity.com: the project&amp;#039;s Settings, and the organization&amp;#039;s)&lt;br /&gt;
powershell -File tools/link-unity-cloud.ps1 -Project D:\Projects\MindAttic\MyGame `&lt;br /&gt;
    -ProjectId 0f8fad5b-d9cb-469f-a165-70867728950e -OrganizationId 1234567890123 -ProjectName MyGame&lt;br /&gt;
&lt;br /&gt;
# Only report where it stands (exit 0 when the package line and the link are both in place)&lt;br /&gt;
powershell -File tools/link-unity-cloud.ps1 -Project D:\Projects\MindAttic\MyGame -Check&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The script writes &amp;lt;code&amp;gt;cloudProjectId&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;organizationId&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;projectName&amp;lt;/code&amp;gt; into &amp;lt;code&amp;gt;ProjectSettings/ProjectSettings.asset&amp;lt;/code&amp;gt;, which is what the Services page&amp;#039;s Link button writes, and adds the package line. It refuses while the editor has the project open, because the editor would overwrite the file. Turning Relay on stays a dashboard switch.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;In CI or batch mode:&amp;lt;/strong&amp;gt; &amp;lt;code&amp;gt;Unity.exe -batchmode -projectPath &amp;amp;lt;game&amp;gt; -executeMethod Unity.Multiplayer.Editor.RelaySetupCheck.CheckBatch&amp;lt;/code&amp;gt; logs the status and exits 0 only when the package is compiled in and the project is linked. Add &amp;lt;code&amp;gt;-addRelayPackage&amp;lt;/code&amp;gt; to add the package line first.&lt;br /&gt;
&lt;br /&gt;
=== At run time ===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strong&amp;gt;Sign-in at startup.&amp;lt;/strong&amp;gt; The NetBootstrap&amp;#039;s &amp;lt;strong&amp;gt;Unity Relay&amp;lt;/strong&amp;gt; section has three fields:&amp;lt;br&amp;gt;With sign-in on, the scene initializes Unity Services in that environment and signs in anonymously as it starts, so &amp;lt;strong&amp;gt;Host&amp;lt;/strong&amp;gt; and &amp;lt;strong&amp;gt;Join by code&amp;lt;/strong&amp;gt; don&amp;#039;t wait for it. A headless dedicated server doesn&amp;#039;t sign in, and neither does a scene whose Join Codes is None or Rendezvous. The sign-in is shared by the whole process. If it fails, the first Relay call tries again. &amp;lt;code&amp;gt;RelayJoinCodeService.SignInAsync()&amp;lt;/code&amp;gt; does the same from code.&lt;br /&gt;
** &amp;lt;strong&amp;gt;Relay Environment&amp;lt;/strong&amp;gt;: the Unity Services environment, &amp;lt;code&amp;gt;production&amp;lt;/code&amp;gt; by default.&lt;br /&gt;
** &amp;lt;strong&amp;gt;Relay Region&amp;lt;/strong&amp;gt;: empty lets Relay pick the region closest to the host.&lt;br /&gt;
** &amp;lt;strong&amp;gt;Sign In At Startup&amp;lt;/strong&amp;gt;: on by default.&lt;br /&gt;
* &amp;lt;strong&amp;gt;Host.&amp;lt;/strong&amp;gt; With Join Codes at Auto and the package installed, &amp;lt;code&amp;gt;HostWithCode&amp;lt;/code&amp;gt; (and the front end&amp;#039;s &amp;lt;strong&amp;gt;Host&amp;lt;/strong&amp;gt; button) creates a Relay allocation for &amp;lt;code&amp;gt;MaxPlayers - 1&amp;lt;/code&amp;gt; players, starts the host on it (DTLS, or &amp;lt;code&amp;gt;wss&amp;lt;/code&amp;gt; for WebSocket) and publishes Relay&amp;#039;s code with the check character added.&lt;br /&gt;
* &amp;lt;strong&amp;gt;Join by code.&amp;lt;/strong&amp;gt; A Relay-shaped code is joined through Relay&amp;#039;s allocation, with no address involved.&lt;br /&gt;
* &amp;lt;strong&amp;gt;When something is missing.&amp;lt;/strong&amp;gt; Nothing is sent to Unity Services when the project isn&amp;#039;t linked: &amp;lt;code&amp;gt;HostWithCode&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;JoinByCode&amp;lt;/code&amp;gt; fail at once with &amp;lt;code&amp;gt;RelaySetup.NotLinkedMessage&amp;lt;/code&amp;gt;, which says how to link it. Other Unity Services failures become a &amp;lt;code&amp;gt;RelaySetupException&amp;lt;/code&amp;gt; whose message names the cause: Relay is off for the project, the environment doesn&amp;#039;t exist, or the game is offline. The drop-in front end shows these in the menu. &amp;lt;strong&amp;gt;Host&amp;lt;/strong&amp;gt; toasts &amp;quot;No join code: ...&amp;quot; and hosts for joining by IP; &amp;lt;strong&amp;gt;Join by code&amp;lt;/strong&amp;gt; shows a &amp;lt;em&amp;gt;Couldn&amp;#039;t join&amp;lt;/em&amp;gt; dialog (see [[Unity.Multiplayer/articles/front-end|Front end]]). &amp;lt;code&amp;gt;RelayJoinCodeService.Readiness&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;NotInstalled&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;NotLinked&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;Ready&amp;lt;/code&amp;gt;) answers the same question in code.&lt;br /&gt;
&lt;br /&gt;
=== Verifying it ===&lt;br /&gt;
&lt;br /&gt;
The PlayMode suite covers everything up to Unity Services without a Cloud project: the not-linked path for &amp;lt;code&amp;gt;HostWithCode&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;JoinByCode&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;JoinByCodeTests&amp;lt;/code&amp;gt;) and for the menus (&amp;lt;code&amp;gt;NetFrontEndTests&amp;lt;/code&amp;gt;). A live Relay game needs a linked project with Relay on. Build the game and run one copy on the home network and one on another, such as a phone&amp;#039;s hotspot. Click &amp;lt;strong&amp;gt;Host&amp;lt;/strong&amp;gt; on the first, then type the lobby&amp;#039;s code into &amp;lt;strong&amp;gt;Join by code&amp;lt;/strong&amp;gt; on the second. The host&amp;#039;s Console logs &amp;quot;Signed in to Unity Services (environment production) for Relay join codes.&amp;quot; when sign-in works.&lt;br /&gt;
&lt;br /&gt;
== The rendezvous service ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;server/Rendezvous&amp;lt;/code&amp;gt; (ASP.NET Core, .NET 10 minimal API) maps a code to a dedicated server&amp;#039;s IP:port. A dedicated server calls &amp;lt;code&amp;gt;POST /v1/register&amp;lt;/code&amp;gt; with its registration secret and gets back a code, a private token and a TTL (default 60 seconds, renewed by a heartbeat every third of it); &amp;lt;code&amp;gt;GET /v1/resolve/{code}&amp;lt;/code&amp;gt; is what a client calls to get the address back. Run it yourself:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-bash&amp;quot;&amp;gt;docker build -f server/Rendezvous/Dockerfile -t mindattic-rendezvous .&lt;br /&gt;
docker run -p 8080:8080 -e Rendezvous&amp;amp;#95;_RegistrationSecret=&amp;amp;lt;secret&amp;gt; mindattic-rendezvous&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [[Unity.Multiplayer/articles/hosting#TLS|Hosting]] for TLS and the full secrets list, and [[Unity.Multiplayer/articles/hosting#The no-port-forwarding path|the no-port-forwarding path]] for when Relay is the only option that works at all (an HOA-controlled network with no port forwarding).&lt;br /&gt;
&lt;br /&gt;
== No join codes at all ==&lt;br /&gt;
&lt;br /&gt;
Set &amp;lt;code&amp;gt;JoinCodeProvider.None&amp;lt;/code&amp;gt; (or leave Relay/the rendezvous service unconfigured) and players join by &amp;lt;code&amp;gt;JoinByAddress(ip, port)&amp;lt;/code&amp;gt; only — useful for a LAN party or when a matchmaking service already knows the address (see &amp;lt;code&amp;gt;JoinAllocatedServerAsync&amp;lt;/code&amp;gt; in [[Unity.Multiplayer/articles/hosting#Per-match allocation, instead of one always-on box|Hosting]] for servers that are allocated per match rather than published as one long-lived code).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;md2wiki-crumb&amp;quot;&amp;gt;Part of [[Unity.Multiplayer]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;md2wiki-source&amp;quot;&amp;gt;From [https://github.com/mindattic/Unity.Multiplayer/blob/main/docs/articles/join-codes.md Unity.Multiplayer/docs/articles/join-codes.md] via MindAttic.Docs; synced automatically, so edit the repo, not this page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Unity.Multiplayer]]&lt;/div&gt;</summary>
		<author><name>Docs Sync</name></author>
	</entry>
</feed>