Skip to content

Unity

Follow the instructions below to create and configure the hive_config.xml file. The file will be created at the following paths. For more details, refer to the Basic Configuration Guide.

  • Android
    • Unity 2021 or later: /Assets/HiveSDK/hive.androidlib/src/main/res/raw/hive_config.xml
    • Unity 2021 or earlier: /Assets/Plugins/Android/res/raw/hive_config.xml
  • iOS
    • /Assets/Plugins/iOS/hive_config.xml
  • Windows
    • /Assets/Plugins/Windows/res/hive_config.xml

Setting with Unity Inspector

In the Unity environment, you can automatically generate the hive_config.xml file and assign configuration values using the Unity Inspector.

Setting OS and authentication version

Select Hive > Edit Config and configure the necessary values on the Inspector screen. First, select the OS and Authentication Version. For example, to use Google authentication, select Android or iOS for OS, and select Auth v4 for Authentication Version.

Google sign-in settings

To use general Google authentication, enter the required values in the Google Sign-in Settings section as follows:

  • Enter the issued AppID in the Google App Id field.
  • Enter the Client ID value of the issued web application in the Google Server Client ID field.

HiveConfig settings

You can configure the following values in the hive_config.xml file. For example, to use Google Play Store payments in the Unity Android environment, set the Market value to GO, and to use Apple AppStore payments in the Unity iOS environment, set it to AP.

Field Description Value range
Zone Hive server environment
  • Sandbox (default)
  • Live
Logging Enable logging for internal operations of the Hive client
  • On (default)
  • Off
Push Whether to use the push service provided by the Hive platform
  • On (default)
  • Off
Company Game publishing company
  • Com2uS: C2S
  • Com2uS Holdings: GVI
Channel Login service platform used by the game app. Hive (default)
Market Market where the app will be released
  • Android: GO (Google), LE (Lebi)
  • iOS: AP (App Store)
hivePermissionViewOn Whether to display the Hive SDK permission popup
  • On (default)
  • Off

Create hive_config.xml file

After completing the Inspector settings, follow the steps below to create the hive_config.xml file.

  • Android: Click the Regenerate Android Manifest & Hive Config button to generate the AndroidManifest.xml file and the hive_config.xml file. The hive_config.xml file will be created in the following directory:
    • Unity 2021 or later: /Assets/HiveSDK/hive.androidlib/src/main/res/raw
    • Unity 2021 or earlier: /Assets/Plugins/Android/res/raw/
  • iOS: Click the Regenerate iOS Plist Hive Config button to generate the Info.plist file and the hive_config.xml file. The hive_config.xml file will be created in the following directory:
    • /Assets/Plugins/iOS/

hive_config.xml example

Below is an example of the hive_config.xml file when using authentication (Google authentication) and payments (Google Play Store or Apple AppStore). Modify, add, or delete values according to the Hive SDK features and app environment you are using. Since iOS only supports Apple AppStore payments, set the market to AP in the Unity iOS environment.

<properties>

    <!-- Hive SDK Common Settings: START -->
    <appId>com.sample.your</appId>

    <gameLanguage>en</gameLanguage>

    <!-- Select the server of Hive platform. sandbox is for development, real is for production
        (sandbox, real) -->
    <zone>real</zone>

    <!-- Enable or disable SDK internal operation logs
        (true, false) -->
    <useLog>false</useLog>

    <!-- Company setting
        (C2S: Com2uS, GVI: Com2uS Holdings) -->
    <company>C2S</company>

    <!-- Channel setting
        (C2S: Hive platform) -->
    <channel>C2S</channel>

    <!-- Payment market setting
        (GO: Google Play, LE: Com2us Lebi, AP: Apple App Store) -->
    <market>GO</market>

    <!-- Set the HTTP Connect Timeout used inside Hive SDK in seconds
        (Do not change unless in special cases) -->
    <httpConnectTimeout>8</httpConnectTimeout>

    <!-- Set the HTTP Read Timeout used inside Hive SDK in seconds
        (Do not change unless in special cases) -->
    <httpReadTimeout>8</httpReadTimeout>

    <agreementDetermineBase>device</agreementDetermineBase>
    <!-- Hive SDK Common Settings: END -->

    <!-- Hive SDK Feature Settings: START -->
    <!-- Authentication product setting: Use Google authentication -->
    <providers>             
        <google playAppId="123456789012"  clientId="123456789012-abc.apps.googleusercontent.com"  serverClientId="123456789012-abc.apps.googleusercontent.com"  reversedClientId="com.googleusercontent.apps.123456789012-abc"  deviceFlowClientId="331526026701-gn1abq1ev23nqj7rdvvlaamf7ii4f3u9.apps.googleusercontent.com" />
    </providers>
    <!-- Hive SDK Feature Settings: END -->
</properties>
Info

Hive SDK settings can be saved in the configuration file before building the app or changed during runtime (app execution). For more details, check Hive SDK Settings.