Get started with Relay

Read the following sections to learn how to set up a Relay project and how to use the Relay sample project.

Note: Not all Unity Editor versions support QoS. Make sure you’re using one of the following versions if you plan to use QoS SDK:

  • 2022.2.0a10+

  • 2022.1.0f1+

  • 2021.3.2f1+

  • 2020.3.34f1+

Set up a Relay project

  1. Install a supported version of the Unity Editor from the Unity Hub.

    Note: If you want to follow along with the sample project, use Unity Editor version 2020.3.

  2. Enable Relay on the Unity Dashboard by toggling the slider to On.


  3. Create a project within the Unity Hub.

  4. Navigate to the manifest.json file and add the preview packages required for running a Relay project. You can find a snippet of these packages in the Unity Dashboard under Project Settings > SDK Download > Generate Code Snippet.

The Unity Editor automatically loads the new packages into your project. You can view them in the Unity Package Manager.

See Simple Relay Sample to learn how to interact with the sample project.

Simple Relay Sample

The Simple Relay Sample is an example project that exercises the Relay SDK. The project provides a simple user interface (UI) with buttons, and is intended for manual testing of the SDK. To try the sample project, follow the steps below.

Import the Simple Relay Sample project

  1. Open a Relay project with the Unity Editor (version 2020.3). If you don’t have a Relay project set up yet, see Set up a Relay project.

  2. Open the Package Manager and navigate to the Relay package.

  3. Expand the Samples section.

  4. Select Import to import the Simple Relay Sample project.

  5. Now that you have imported the Simple Relay Sample project, you can open it as a scene. It is located within the current project under Assets/Samples/Relay/1.0.1-pre.3/Simple Relay Sample.

  6. Select File > Open Scene.

  7. Navigate to the Simple Relay Sample scene.

Continue onto Use the Simple Relay Sample to learn how to use it.

Use the Simple Relay Sample

  1. Sign into the Unity Editor

  2. Go to Account > Sign in…

  3. Selecting the Sign in button opens the Unity Dashboard in a browser window. Make sure you’re signed into the same account with the Relay-enabled project.

  4. Link a project to the Simple Relay Sample.

  5. Select Edit > Project Settings…

  6. Select Use an existing Unity project ID.

  7. Select the organization and the project.

  8. Select Link project ID.

  9. If successful, your project ID appears under Unity Project ID.

Start the Simple Relay Sample

  1. Select the Play button to start the sample.

  2. Go through and select each of the buttons within the sample in order:

    1. Sign In (Anonymously) uses Unity’s Anonymous authentication to sign into Relay. This generates a player ID.

    2. Get Regions lists all the regions in which a Relay server is available.

    3. Create Relay creates a Relay allocation and returns the host allocation ID.

    4. Get Join Code generates a join code for the host to share with other players.

    5. Join Relay joins the Relay allocation and returns a player allocation ID.