Install the Unity SDK
Overview
Use the AccelByte Gaming Services (AGS) Game SDK for Unity to implement AGS features in your game.
AGS Unity SDK on GitHubPrerequisites
- Unity version 2019.2 or newer
- Create a Game Namespace
- Create an IAM Client
- Get the Client ID
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
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.
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.
Open your Unity Project.
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.NOTEEnsure 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.
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.
a. Configure the SDK using the Editor tool: Go to AccelByte > Edit Settings in the menu bar. Fill in Namespace,Base Url, Client Id, Client Secret, Redirect Uri, and App Id. Leave the other fields empty and click Save.
After you do this, the system will generate and auto populate the
AccelByteSDKConfig.json
,AccelByteSDKOAuthConfig.json
andAccelByteServerSDKOAuthConfig.json
files in yourAssets/Resources
folder.To modify the configuration files manually, follow the step for option b, below.
b. Create Config Files Manually: Create a file called
AccelByteSDKConfig.json
in yourAssets/Resources
folder and fill it with the appropriate information in the following format:NOTELeave the Publisher namespace parameter empty.
{
"Default":
{
"Namespace": "Game Namespace",
"UsePlayerPrefs": true,
"EnableDebugLog": true,
"DebugLogFilter": "Log",
"BaseUrl": "<baseURL>",
"RedirectUri": "http://127.0.0.1",
"AppId": "",
"PublisherNamespace": ""
}
}NOTEYou can find your ClientID, Secret, and Namespace settings in the AGS Admin Portal or refer to the Access documentation for more information.
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://dev.gamingservices.accelbyte.io
and the production env's base URL ishttps://prod.gamingservices.accelbyte.io
.Next, create two files and name them
AccelByteSDKOAuthConfig.json
andAccelByteServerSDKOAuthConfig.json
. Add both files to your project in theAssets/Resources
directory; their contents should be as follows:{
"Default":
{
"ClientId": "<OAuth Client ID>",
"ClientSecret": "<OAuth Client Secret>"
}
}
Leave the Client Secret empty if the Game Client uses the Public Client type.
Congratulations! You successfully configured the AGS SDK for Unity.