Get started with Friends

You must link your project with the Unity Dashboard, enable the Friends service, and import the SDK before using the Friends service in your project

You must link your project with the Unity Dashboard to use the Friends service.

  1. From the Unity Editor, select Edit > Project Settings... > Services.
  2. Link your project.
    1. If your project doesn't have a Unity project ID:
      1. Select Create a Unity Project ID > Organizations, then select an organization.
      2. Select Create project ID.
    2. If you have an existing Unity project ID to use:
    3. Select Use an existing Unity project ID.
    4. Select an organization and a project.
    5. Select Link project ID.

Your Unity Project ID now appears in Unity Editor, and the project is linked to Unity’s cloud services. You can also access your Unity Project ID in code using UnityEditor.CloudProjectSettings.projectId.

Enable the Friends service

You can enable the Friends service for your project from the Unity Dashboard.

  1. Sign in to the Unity Dashboard.
  2. Select your project.
  3. Navigate to Multiplayer > Friends.
  4. You can enable Friends from the Overview page or the Setup Guide.

The Setup Guide walks you through linking your Unity project, installing the Friends package, and enabling the Friends service.

Import the Friends SDK

  1. Sign in to the Unity Dashboard.
  2. Select your project.
  3. Select Project Settings.
  4. Select Settings > SDK Download.
  5. Select Friends from the list of available packages. Doing so also selects any package dependencies.
  6. Select Generate Code Snippet.
  7. Copy the code snippet that appears on the screen.
  8. Paste the code snippet in your project’s Packages/manifest.json file in the dependencies object.
  9. Save the file.
  10. Install the package through the Package Manager in the Unity Editor. Refer to the Package Manager documentation.

Initialize the Friends service

Once you’ve enabled the Friends service and imported the Friends SDK through the Package Manager in the Unity Editor, initialize the Core SDK using await UnityServices.InitializeAsync().

The following code snippet shows how to initialize the Friends service and any other Unity services in your project.

// Import required packages
using Unity.Services.Core;
using Unity.Services.Authentication;
private async Task MyMethod()
    // Initialize all of the used services
    await UnityServices.InitializeAsync();

    // Sign in anonymously or using a provider
    await AuthenticationService.Instance.SignInAnonymouslyAsync();

    // Initialize friends service
    await FriendsService.Instance.InitializeAsync();

    // Start using the Friends SDK functionalities.
    var friends = await FriendsService.Instance.Friends;