Get started with Moderation

Note: Before you get started with Unity Moderation, make sure you meet all the requirements.

You can get started with Unity Moderation by following the instructions below.

  1. Link your project with the Unity Cloud Dashboard.
  2. Activate Unity Moderation for your project.
  3. Import the Moderation SDK.
  4. Initialize Unity services.

Activate Unity Moderation for your project

To get started with Moderation, reach out to the Moderation support team to enable it in your project.

  1. Log into the Unity Cloud Dashboard.
  2. Select the Organization for which Unity Moderation is enabled.
  3. Select the Products tab from the sidebar.
  4. Under Community, go to Moderation and select Launch.

Ensure Moderation endpoints are allowlisted

If you're using Access Control in your project, you might be applying a Deny by Default strategy.

If so, in order to allow the Moderation SDK to send reports to the Moderation service, you need to give players the ability to send reports.

Add the following policy to your project to grant players the ability to send reports:

{
  "Sid": "allow-moderation-report",
  "Action": ["*"],
  "Effect": "Allow",
  "Principal": "Player",
  "Resource": "urn:ugs:moderation-report:/*"
}

Import the Moderation SDK

Once you've linked your project to the Unity Cloud Dashboard, you can install the latest version of the Moderation package.

Use the Unity Package Manager to import the Moderation package in the Unity Editor.

The Modersation package is in Preview, you need to enable preview packages to see it in the Package Manager. To enable Preview packages in the Unity Editor, select Edit > Project Setting > Package Manager > Advanced Settings.

Note: The Moderation SDK is available in the following version of Unity in the Package Manager:

  • 2021.3.32f1
  • 2022.3.12f1
  • 2023.1.17f1
  • 2023.2.0b15
  • 2023.3.0a11

Dependencies

To use the Moderation SDK you will need additional Unity packages. Some are mandatory requirements while others are optional requirements:

Package nameMinimum versionType of requirementUse case
com.unity.services.moderation0.0.1-preMandatoryThe Unity Moderation package.
com.unity.services.core1.4.2MandatoryTo initialize Unity services ecosystem.
com.unity.services.authentication2.1.1 or 2.5.0-pre.3 (If you require Player Names.)MandatoryTo authenticate players in UGS services.
com.unity.nuget.newtonsoft-json3.0.2MandatoryThis package enables the other packages to handle JSON formatted responses.

For information on the Authentication package, refer to the Authentication documentation.

Additional packages

Using Vivox in your application can provide additional details on incidents. With the Vivox package, you can gather channel data and events by including the player ID and channel IDs in the report.

Package nameMinimum versionType of requirementUse case
com.unity.services.vivox16.0OptionalUsing a Vivox v16.0.0 package or higher will allow Moderation to gather channel information to enrich incident reports in the Moderation dashboard.

Initialize Unity services

The Moderation SDK exposes a singleton instance of a class that can be used to report players. To use it, initialize Unity Services and authenticate your players with Unity Authentication Service (UAS).

The following code is an example of how to authenticate a user using UAS:

using Unity.Services.Core;
using Unity.Services.Authentication;
async void Start()
{
    await UnityServices.InitializeAsync();
    await AuthenticationService.Instance.SignInAnonymouslyAsync();
    if (AuthenticationService.Instance.IsSignedIn)
    {
        // game code.
    }
    else
    {
        Debug.Log("Player was not signed in successfully?");
    }
}