Unity setup

This guide will walk you through a step-by-step process to set up a basic Unity project using the Gamedonia Backend Platform. You can also watch this video tutorial:


Get the Gamedonia Unity SDK

Log in to Gamedonia and get the SDK at the Download Area. We recommend checking the SDK version, as we're regularly updating them.

Integrate game with backend

Setup Unity Project

  1. Download GamedoniaSDK_Unity3D_vX.X.X.unitypackage file.

  2. Open Unity and select Create New Project (if you're already working on a Unity project, skip this step and go to step 3).

It's important that you DO NOT import any packages yet, you will do after.

  1. To import the GamedoniaSDK_Unity3D_vX.X.X.unitypackage to the work area, first of all you need to select Assets > Import Package > Custom Packages... 

  1. Then you need to find your download destination folder where you saved the package and select GamedoniaSDK_Unity3D_vX.X.X.unitypackage. Finally select All and Import it.

If you are importing this SDK over a project with the Gamedonia Realtime SDK, remember to reimport all assets right after the import finishes. You can do that going to Assets > Reimport all.

Create a Game in Gamedonia

We need to create a game in the Gamedonia Dashboard to be able to continue. The Dashboard is the developer tool that will allow you to manage all the related modules of the game. Now let's see how we can create a game.

  1. Click the Add New backend button.

  2. Write the name of your new backend, select the platform and press Save when ready, your game will be created inmediately and will be ready to start communicating with your game client.

Configure the Unity Project

  1. You can see that at the Project Area you have multiple folders with files. The important one here is the file named Gamedonia at the Prefab's folder. Drag the Gamedonia Prefab file to the Hierarchy area to edit it.

  1. The last part is preparing the Gamedonia file with your Gamedonia's credentials. To do that select the Gamedonia file from the Hierarchy and fill the Api Key and Secret with the values that you can find at the Game Management > Information page.

When developing your app for the App Store or Google Play or whatever public market you should use the normal key that will respect all the security policies defined in your app. Use this as your default.

The master key lets you override permissions and access all entities and collections in the game, ignoring their Read/Write permissions.

Set the Gamedonia Backend namespace wherever you need to use Gamedonia classes. You can do it like this:

	using Gamedonia.Backend;

User Authentication

Now your app is ready to perform calls to Gamedonia Backend!

You may be wondering what could be the first thing to do now that you have access to your own game backend. Why not create a User and log him in? You will need a logged in user (valid Gamedonia session) to invoke most of the Gamedonia API calls.

Create your first user

We will start with an easy example, where we create a user with email credentials ( email and password ). Here's how to create a user. Put this at the Start() method of a Unity script.

// First create the credentials object for the account. We use email credentials
Credentials credentials = new Credentials();
credentials.email = "the_email";
credentials.password = "the_password";
// Create the user account with some profile data (nickname) and attach it to the credentials created in the previous block
GDUser user = new GDUser();
user.credentials = credentials;
user.profile["nickname"] = "the_nickname";
// Make the request to Gamedonia Backend to create the account and process the result in a block.
GamedoniaUsers.CreateUser(user, delegate (bool create_success) {

    if (create_success){
        // The user was created successfully, so we can log him in
        GamedoniaUsers.LoginUserWithEmail("the_email", "the_password", delegate (bool login_success) {

            if (login_success){
                //TODO Your login user success processing
            } else {
                //TODO Your login user fail processing

    } else {
        //TODO Your create user fail processing

Now that the user is created, you can head to your Gamedonia Dashboard and check that the user exists at your backend's Users collection.

To do this, open the Data Storage > Object Browser section and select the collection called Users. The user you just created will be shown there as a Content Object. You can explore its credentials and profile (which should include the nickname you introduced).

If you paid attention to the code, you will realize that we are logging the user in right after the create response comes back as susccessful. Of course you can do this independently wherever you want if you want to have a different code flow:

Login a user

The call to log in a user is the one that gets you a session token and, with it, the authentication to perform the rest of the API calls of the Gamedonia API. The credentials must be the ones of a created user at the Users collection.

        GamedoniaUsers.LoginUserWithEmail("the_email", "the_password", delegate (bool login_success) {

            if (login_success){
                //TODO Your login user success processing
            } else {
                //TODO Your login user fail processing

We recommend continuing with the Users Guide or the Data Storage Guide.