Get started with the Moderation Platform

Attention: The Digital Services Act (DSA) requires Unity to notify our customers’ end users if Unity takes an action that impacts those end users under the DSA. To comply with this requirement, if you use Unity Gaming Services (UGS) products that rely on the Unity Authentication Service, you must integrate the notification API.

For more information on DSA, refer to the Digital Services Act - compliance update.

To make your game compliant, refer to DSA notifications.

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

If you have Safe Text or Safe Voice enabled in your project, you have access to the Moderation Platform within the Unity Cloud Dashboard.

You can follow the steps in the Safe Voice or Safe Text documentation to activate either product in your project.

After Safe Text or Safe Voice has been added to your project, follow these steps:

  1. Ensure Moderation endpoints are on the allowlist.
  2. Add the Moderation SDK.
  3. Initialize Unity services.

Once Moderation is working in your project, assign User roles of Safety Admin and Safety Moderator to other members of your project to begin reviewing reports.

Ensure Moderation endpoints on the allowlist

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 Moderation 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

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?");
    }
}