Skip to main content

Install the Unity SDK

Last updated on April 23, 2024

Overview

Use the AccelByte Gaming Services (AGS) Game SDK for Unity to implement AccelByte Gaming Services (AGS) features in your game.

AGS Unity SDK on GitHub

Prerequisites

  • Unity version 2019 or newer
  • Create a Game Namespace
  • Create an IAM Client
  • Get the Client ID
AGS Starter

AGS Starter currently supports Unity versions 2019.2 and 2019.4 upwards.

Also, make sure that you use the following format for the BaseUrl, otherwise your API calls may return an error due to a domain mismatch:

https://<Game TitleID>.<environment name>.gamingservices.accelbyte.io
  • Use the dev value when you're working on a development environment. For example: https://spaceshooter.dev.gamingservices.accelbyte.io
  • Use the prod value when you're ready to launch to a live environment. For example: https://spaceshooter.prod.gamingservices.accelbyte.io

Tutorial

NOTE

You must install and configure Git on your computer so that Unity can use a UPM Package.

Install and configure

Learn how to download and install the AGS Game SDK for Unity and set up your AGS configuration file.

AGS Starter

In Starter tier, you can download and save the configuration file for Unity.

You can download the configuration files in the Starter tier dashboard during set up. Later, you can also download them from the OAuth Clients page in the AGS Admin Portal.

AGS Premium does not yet have the configuration file download option.

  1. Open your Unity Project.

  2. Go to Window > Package Manager > + > Add package from git URL, paste https://github.com/AccelByte/accelbyte-unity-sdk.git into the pop-up, and click Add.

    note

    Ensure that you download the latest version.

    If you are using Assembly Definitions in your project, you may need to add the com.accelbyte.UnitySDK assembly as a reference.

  3. Configure the SDK.

    There are two ways to configure the SDK in your project. You can use our editor tool or manually create and modify the configuration files.

    Configure the SDK using the Editor tool

    Go to AccelByte > Edit Client Settings in the menu bar to edit client configuration or Edit Server Settings for server configuration. Fill out required fields shown on the editor. After filling out the fields and click Save.

    Using the editor

    After you do this, the client editor will generate and auto populate the AccelByteSDKConfig.json and AccelByteSDKOAuthConfig.json. The server editor will generate AccelByteServerSDKConfig.json and AccelByteServerSDKOAuthConfig.json. Every AccelByte SDK config file will be saved in the Assets/Resources folder.

    Create config files manually

    Create these files in your Assets/Resources folder and fill it with the appropriate format. Replace the "Required" value based on the AGS Admin Portal config.

    AccelByteSDKConfig.json

    {
    "Default": {
    "BaseUrl": "Required",
    "Namespace": "Required",
    "PublisherNamespace": "Required",
    "RedirectUri": "Required",
    "UsePlayerPrefs": false,
    "EnableDebugLog": true,
    "DebugLogFilter": "Verbose",
    "IamServerUrl": "",
    "PlatformServerUrl": "",
    "BasicServerUrl": "",
    "LobbyServerUrl": "",
    "CloudStorageServerUrl": "",
    "GameProfileServerUrl": "",
    "StatisticServerUrl": "",
    "QosManagerServerUrl": "",
    "AgreementServerUrl": "",
    "LeaderboardServerUrl": "",
    "CloudSaveServerUrl": "",
    "GameTelemetryServerUrl": "",
    "AchievementServerUrl": "",
    "UGCServerUrl": "",
    "ReportingServerUrl": "",
    "SeasonPassServerUrl": "",
    "SessionBrowserServerUrl": "",
    "SessionServerUrl": "",
    "MatchmakingV2ServerUrl": "",
    "UseTurnManager": true,
    "TurnManagerServerUrl": "",
    "TurnServerHost": "",
    "TurnServerPort": "",
    "TurnServerPassword": "",
    "TurnServerSecret": "",
    "TurnServerUsername": "",
    "PeerMonitorIntervalMs": 200,
    "PeerMonitorTimeoutMs": 2000,
    "HostCheckTimeoutInSeconds": 60,
    "GroupServerUrl": "",
    "ChatServerWsUrl": "",
    "ChatServerUrl": "",
    "GdprServerUrl": "",
    "AppId": "",
    "CustomerName": "",
    "EnableAuthHandshake": false,
    "MaximumCacheSize": 100,
    "MaximumCacheLifeTime": 100,
    "EnablePresenceBroadcastEvent": true,
    "PresenceBroadcastEventInterval": 600,
    "PresenceBroadcastEventGameState": 0,
    "PresenceBroadcastEventGameStateDescription": "",
    "EnablePreDefinedEvent": false,
    "EnableClientAnalyticsEvent": false,
    "ClientAnalyticsEventInterval": 10.0,
    "EnableAmsServerQos": false
    }
    }

    AccelByteSDKOAuthConfig.json

    {
    "Default": {
    "ClientId": "Required",
    "ClientSecret": ""
    }
    }
    important
    • You can find your ClientID, Secret, and Namespace settings in the AGS Admin Portal.
    • For AGS Starter, use the following formats:
      • For Namespace: <Studio ID>-<Game TitleID>
      • For Publisher: <Studio ID>.
    • Leave the Client Secret empty if the Game Client uses the Public Client type.
    • Contact support or your Account Manager if you're unsure of your API URLs. If you're in AGS Starter, the development env's base URL is https://prod.gamingservices.accelbyte.io and the production env's base URL is https://prod.gamingservices.accelbyte.io.

Congratulations! You successfully configured the AGS SDK for Unity.