Unity SDK

Introduction

Welcome to the Ocugine Unity SDK documentation section. Here you can learn some basics of the our SDK. If you need to get some additional information - please, visit our forums.

If you want to use latest stable Unity SDK - please, visit our GitHub releases page.

Build Information

This build tested on Unity 2018.3.1f1.

Ocugine Unity SDK work features:

  • Currently our SDK tested only for Windows, WebGL, Android and iOS;
  • This SDK version uses .NET 4.x equivalent for Unity;
  • If you have a troubles with Prefabs - initialize SDK via Components for empty Object and move SDK Object up to top in the hierarchy;

Installation and Setup

When you have downloaded the Unity SDK you need, you need to extract it to the folder with your project.
After what, launch Unity and try to get add new prefab (via Instanite Prefab or by creating a new empty object with Ocugine SDK => SDK Manager component).

If you have some troubles with Prefab Instanite - Please, add new empty object, up them to top in the hierarchy and add component "Ocugine SDK" => "SDK Manager";

When your Prefab will be ready, please, setup the SDK settings:

Let's look at the something settings:

  • Application Settings - Here you need to setup the most important information about the Project and Project ID / Project Keys. You can get your ID and Key here;
  • SDK Settings - Here you can setup additional SDK settings.
  • Debug Settings - Enable / Disable Debug Mode;

User Authentication

When you setup the SDK, you can try to work with them. So, let's authtorize user via Ocugine SDK:

SDK.ui.GetAuthForm(((OAuthTokenModel token_data) => {
    Debug.Log("Complete! Token Data: " + token_data.data.access_token);
}), ((string error) => { // Error
    /* TODO: Error */
}), "all");

And that's all that you need to connect users zone for your project. Now, your players can authenticate in your game by few clicks.

Classes List

The list of available classes:

  • OcugineSDK - General SDK Class;
  • Ocugine_Auth - OAuth Authentication Class;
  • Ocugine_Analytics - Analytics Class (for example: events and conversions);
  • Ocugine_GameServices - Game Services Class (for example: achievements);
  • Ocugine_Monetization - Monetization Class;
  • Ocugine_Notifications - In-Game Notifications class;
  • Ocugine_Marketing - Marketing Class;
  • Ocugine_Ads - Advertising Class;
  • Ocugine_Backend - Cloud Management Class;
  • Ocugine_Reports - Errors and Performance Reporting Class;
  • Ocugine_Localization - Localization Class;
  • Ocugine_Users - Ocugine Users Class;
  • Ocugine_UI - Ocugine UI Modules Class;
  • Ocugine_Utils - Ocugine Utils Class

Data Models

Then you work with Ocugine SDK - you need to use data models. For example:

/* Cloud Saves List */
[System.Serializable]
public class CloudSavesListModel
{
    public DataModel data;

    [System.Serializable]
    public class DataModel
    {
        public CloudSaveModel.DataModel[] list;
    }
}

/* Cloud Saves Data */
[System.Serializable]
public class CloudSaveModel : BaseModel
{
    public DataModel data;

    [System.Serializable]
    public class DataModel
    {
        public double uid = 0;
        public double project_id = 0;
        public double profile_uid = 0;
        public string data = "";
        public double time = 0;
    }
}

This is a cloud-saves model. You need to use this model in the callbacks.

Ocugine SDK has base models:

[System.Serializable]
public class BaseModel{
    public bool complete = false;           // Complete Status
    public string message = null;           // Message Status
}