Skip to content

Integration Guide

Efficiently integrate Balancy into your gaming environment with our Unity plugin and initialize it with ease.

Plugin Installation

Ensure a smooth integration with these straightforward steps:

  1. Download Plugin: Obtain the most recent version of the plugin here.
  2. Import to Unity: Incorporate the Balancy plugin into your Unity project.
  3. Authorization:

    • Navigate to Tools ► Balancy ► Config post-compilation.
    • Use the Balancy platform credentials to authorize.

    Authorization Screenshot

  4. Game Code Generation:

    • Choose the relevant game.
    • Click Generate Code to proceed.

    Code Generation Screenshot

Plugin Initialization

Locate YOUR_GAME_ID and YOUR_PUBLIC_KEY on the Balancy dashboard for subsequent code utilization:

Integration Information Screenshot

Utilize the following code to initialize Balancy:

Balancy.Main.Init(new AppConfig
    ApiGameId = YOUR_GAME_ID,
    PublicKey = YOUR_PUBLIC_KEY,
    Environment = Constants.Environment.Development,                
    AutoLogin = true,
    OfflineMode = false,
    Platform = Constants.Platform.AndroidGooglePlay,
    PreInit = PreInitType.None,
    OnInitProgress = progress =>
        Debug.Log($"***=> STATUS {progress.Status}");
        switch (progress.Status)
            case BalancyInitStatus.PreInitFromResourcesOrCache:
                //CMS, loaded from resource or cache is ready, invoked only if PreInit >= PreInitType.LoadStaticData
            case BalancyInitStatus.PreInitLocalProfile:
                //Local profile is loaded, invoked only if PreInit >= PreInitType.LoadStaticDataAndLocalProfile
            case BalancyInitStatus.DictionariesReady:
                //CMS is updated and ready
            case BalancyInitStatus.Finished:
                //All systems are ready
                throw new ArgumentOutOfRangeException();
    UpdateType = UpdateType.FullUpdate,
    UpdatePeriod = 300,
    OnContentUpdateCallback = updateResponse =>
        Debug.Log("Content Updated " + updateResponse.AffectedDictionaries.Length);
    OnReadyCallback = response =>
        Debug.Log($"Balancy Init Complete: {response.Success}, deploy version = {response.DeployVersion}");

Initialization Parameters

Explore and customize your initialization with the following parameters to enhance your game’s integration with Balancy:

Parameter Default Value Description
ApiGameId null A unique GUID associated with your game.
PublicKey null Essential public key needed for various game operations.
Environment Development Specifies the Balancy connection environment. Learn More.
AutoLogin true When true, the user is automatically authenticated by device ID during initialization.
OfflineMode false When true, content from Resources and LocalStorage is utilized without internet data updates, including LiveOps.
Platform autodetect Identifies the platform used at launch, vital for payments and analytics.
PreInit None Initializes Balancy using local data, before internet updates, for a quicker game launch, especially with a slow connection.
OnInitProgress null A callback that displays the progression during initialization. Refer to the code example above.
UpdateType FullUpdate Dictates the type and extent of content updates during runtime.
UpdatePeriod 300 Defines the time (in seconds) between subsequent attempts to update data.
OnContentUpdateCallback null A callback invoked when game content is updated at runtime.
OnReadyCallback null The concluding callback, activated once all updates and systems are prepared and operational.

Customizing these parameters helps in refining the initialization process, ensuring a smooth and adaptive integration of Balancy into your gaming application.

Double-check environment

Don't forget to change environment to production, when you go live. Read best practices to better understanding of deploy process.

Initialization Flow

Init Flow Screenshot