Skip to content

Unity

This document guides you through setting up authentication in Hive SDK Unity.

Unity inspector settings

Select Hive > Edit Config and set the OS and Authentication Version in the Inspector window. Then, enter the AppID, Web Application ClientID, and other information obtained from each IdP provider console, such as Google, Google Play Games, QQ, etc. (See here to learn how to add IdPs).

OS: Android, Authentication Version: Auth V4

OS: iOS, Authentication Version: Auth V4

Note

For details about the values to be entered, refer to the documentation of each IdP provider console.

EDM4U plugin settings

  1. Click the Hive > ExternalDependency menu.

    2. Once the settings window appears, select the features you want to use.

Adding features

In Hive Module Settings, select the authentication features you want to use.

  • Device Management: Device Management Service
  • reCAPTCHA: Use Google Recaptcha for guest login.
  • Real Name Verification: This feature is only for games that have received a Chinese license. It requires users accessing from China to undergo real-name verification.
  • Google InAppUpdate: Google In-app Update function (Android)

Adding idps

In Auth Settings, select the IdPs you want to use. For example, to use Google IdP, select Google SignIn in Auth Settings. To use GooglePlayGames IdP, select Google Play Games. As another example, to use Facebook login, select Facebook in Auth Settings.

Note

To apply the VK library in Unity Android builds, you need a minimum SDK version of 21 or higher and a target SDK version of 32 or higher. Follow the instructions here to add VK settings.
To apply the Line library in Unity Android builds, you need a minimum SDK version of 24 or higher.

Unity login simulator (optional)

The Unity Login Simulator allows you to temporarily issue AuthV4 guest accounts available in the Hive Sandbox server environment. The Unity Login Simulator feature can be found in the Hive > LoginSimulator > Open AuthV4 Setting menu as shown below.


To use this feature, you need to meet the following conditions:

  1. hive_config.xml setup complete
  2. The appId must be filled in hive_config.xml for the current platform (iOS, Android, Windows, Mac) set in the Unity-Build settings menu (auto-filled).
  3. Enter the Hive Authentication Key.
    After meeting these conditions, each time you press the Create button, a new guest account will be issued and the account information will be saved in a file.

You can obtain temporary guest account information through the following example code. did and other additional information except playerId and playerToken are temporary values created or specified by the client.

// playerId issued from the Hive Sandbox server
long playerId = AuthV4LoginData.playerId;
// playerToken issued from the Hive Sandbox server
string playerToken = AuthV4LoginData.playerToken;
// playerName set temporarily by the client
string playerName = AuthV4LoginData.playerName;
// playerImageUrl set temporarily by the client
string plalyerImageUrl = AuthV4LoginData.playerImageUrl;
// did set temporarily by the client (random value between 1000000000 and 2000000000)
string did = AuthV4LoginData.did;
Warning

This account is a temporary Hive Sandbox-only guest account issued for convenient testing on the Unity editor screen. Be careful not to mix it with the information of accounts used in commercial services.