Get started | Unity Realtime

This guide will walk you through a step-by-step process to set up a basic Unity project using the Gamedonia Realtime Platform.

Get the Gamedonia Unity RT 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.

Import the SDK

  1. Download GamedoniaRT_v1.0.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).

  3. To import the Gamedonia SDK to your project, first of all you need to select Assets > Import Package > Custom Packages...

  4. Then you need to find your download destination folder where you saved the package and select the downloaded file (GamedoniaRT_v1.0.unitypackage). Finally, click on Select All and Import.

If you are importing this SDK over a project with the Gamedonia Backend 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 Game button.

  2. Write the name of your new game, 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 GamedoniaRT at the Prefabs folder. Drag the GamedoniaRT Prefab file to your main scene.

  2. Then you need to set the Server field to This is the IP Address of the Gamedonia Realtime server.

  3. The last part is setting your Gamedonia credentials. to do that select the Gamedonia object 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.

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

Connecting to Gamedonia

The last step is to connect to the Gamedonia Servers by calling the Connect() method of the GamedoniaRT class. You should do this in the Start() or Awake() method of your main game object.

	GamedoniaRT.SharedInstance ().Connect();

GamedoniaRT is the entry point to all calls to the Real Time SDK. This class is a singleton, so there is only one instance in all your game. It handles the underlying connection to the server and gives you the channel to exchange information between the client and the server.

To check the result of the connection attempt, you should listen to these two events registering the success and error callbacks at the Awake() or Start() method of your class:

GamedoniaRT gdRt = GamedoniaRT.SharedInstance();
gdRt.AddEventListener (GamedoniaEvents.ON_CONNECTION_SUCCESS, OnConnectionSuccess);
gdRt.AddEventListener (GamedoniaEvents.ON_CONNECTION_ERROR, OnConnectionError);

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

	using Gamedonia.Rt;

Now you're game is ready to start calling the real-time API. Learn more about the real-time basics here.