SDK Getting Started

You can use an SDK to help implement AccelByte services in your game. The SDK acts as a bridge between your game and our services, making those services easy to access. There are two SDKs available for you to use as follows.

Download Unity SDKDownload UE4 SDK

Tutorials

To get started with Unity, you are required to install the Unity plugin either from package or source code.

Find the Package You've Downloaded

  1. Open the Unity editor, then open your project.
  2. Go to Assets > Import Package on the menu bar.
  3. Choose Custom Package.
  4. Search for the package you've downloaded.

Input the JSON Content into AccelByteSDKConfig.json

  1. Ensure that you have already created the AccelByteSDKConfig.json file.
  2. Input the required information into the fields listed below.
{
"ClientId":"<GAME_CLIENT_ID>",
"ClientSecret":"<GAME_CLIENT_SECRET>",
"UseSessionManagement": true,
"PublisherNamespace":"<YOUR-PUBLISHER-NAMESPACE>",
"Namespace":"<YOUR-GAME-NAMESPACE>",
"BaseUrl": "<SERVER-BASE-URL>",
"LoginServerUrl":"<AUTH-SERVER-URL>",
"IamServerUrl":"<IAM-SERVER-URL>",
"PlatformServerUrl":"<PLATFORM-SERVER-URL>",
"BasicServerUrl":"<BASIC-SERVER-URL>",
"LobbyServerUrl":"<LOBBY-SERVER-URL>",
"TelemetryServerUrl":"<TELEMETRY-SERVER-URL>",
"RedirectUri":"http://localhost",
"CloudStorageServerUrl":"<CLOUDSTORAGE-SERVER-URL>",
"GameProfileServerUrl":"<GAMEPROFILE-SERVER-URL>",
"StatisticServerUrl": "<STATISTIC-SERVER-URL>"
}
note

If your game will be released without a publisher, you’ll be able to do everything related to your game in the game namespace. You can leave PublisherNamespace in the config file empty or null.

Install the Unity Plugin from the Source Code

To get started, first you need to download the AccelByte repository. To do so, follow the steps below.

  1. Create a file named AccelByteSDKConfig.json.
  2. After you create the file, add it to the Assets\Resources directory.
  3. Input the required information into the appropriate fields.
  4. Copy the whole Assets/AccelByte folder from the repository and add it to your project in the Assets directory.

Install the Unity Plugin from the Package

Ensure that you have downloaded the Unity package before getting started.

  1. Find the package you've downloaded.
  2. Click the All button to select all of the components.
tip

You can exclude any API that you’re sure you won’t use, such as CloudStorage, Telemetry, etc. If you need these APIs at a later date, you’ll be able to import them without reinstalling the Unity plugin.

  1. Click Import and wait for the installation to finish.
  2. Go to Assets\Resources and search for a file named AccelByteSDKConfig.json, then input the required content into the appropriate fields.
  3. Your SDK is ready to use!

Plugin Usage

Here’s an example of how to use the SDK to create a new user profile. Note that you must be logged in before you can implement any backend services.

using AccelByte.Api;
using AccelByte.Models;
using AccelByte.Core;
class MainMenu
{
public void OnLoginClick(string email, string password)
{
var user = AccelBytePlugin.GetUser();
user.LoginWithUsername(email, password,
result =>
{
if (result.IsError)
{
Debug.Log("Login failed");
}
else
{
Debug.Log("Login successful");
}
});
}
public void OnCreateProfileClick()
{
var userProfiles = AccelBytePlugin.GetUserProfiles();
userProfiles.CreateUserProfile(
new CreateUserProfileRequest
{
language = "en",
timeZone = "Asia/Jakarta",
firstName = "John",
lastName = "Doe",
dateOfBirth = "2000-01-01"
},
result =>
{
if (result.IsError)
{
Debug.Log("Creating user profile failed");
}
else
{
Debug.Log("User profile created.");
Debug.Log("First Name: " + result.firstName);
Debug.Log("Last Name: " + result.lastName);
}
});
}
}

What's Next?

  • Learn how to implement our services in Unity using our sample game as your guide.