Shield Module for Unity

With now.gg Shield module for Unity, you can integrate the Shield API within your game on Unity.

To implement the Shield Module to your project on Unity:

  1. Download and Import the Shield Module for Unity.
  2. Integrate the Shield Module with your project

Download and Import the Module

Shield Module for Unity is included as a Unity package file nowgg-shield.unitypackage.

Add the Shield module to your Unity project:

  1. Download the package containing the latest version of the Shield Module for Unity.
  2. After downloading the module, import it into your Unity project. To do this:
    • Click on Assets > Import Package > Custom Package, as shown below:
    • Select nowgg-shield.unitypackage that you previously downloaded.
    • Select all the listed files and click on Import.

Once all the module files have been imported, a folder named ‘NowGGSdk’ will be added to your project. You can find this folder within the root of the Assets folder.

Note: Please do not modify the NowGGSdk folder, as that contains all the assets related to the Shield module.

Add Required Dependencies

This operation will download and add all the required dependencies to the Assets/Plugins/Android directory of your project using the Unity External Dependency Manager.

To add the required dependencies:

  • Click on Assets > External Dependency Manager > Android Resolver > Resolve.

Integrating Shield Module

This section contains the steps to integrate the Shield Module.

1. Get Session Token

The first step is to generate a session token.

To generate the session token on-demand, call the GetSessionToken function of the NowGGSecuritySdkManager class, as illustrated below:

void Start()
 {
     NowGGSecuritySdkManager.Instance.OnSessionToken += OnSessionToken;
     NowGGSecuritySdkManager.Instance.GetSessionToken();
 }

 private void OnSessionToken(bool success, string token, string pkgName)
 {
     Debug.Log("on token success");
 }

Note: The token must be sent to your game backend immediately (session token expires after 5 minutes), which will validate it with the Bluestacks backend

2. Send session token to Game Backend

The next step is to send this session token to your game backend for validation. Your backend server will then validate this sessionToken with the BlueStacks backend, as illustrated in the next step.

3. Validate the session token

The next step is to validate the session token. Use the Validate Session Token API at your game backend to verify the token from the BlueStacks backend.

Note: You can get the secret_api_key (Shield API Key) by following the steps mentioned here.

4. Handle the response of session token validation

In the final step, your game backend will receive the response of session token validation from the BlueStacks backend. You can handle this response in your game client as per your requirements.

The following is the expected response:

{
    is_verified: <True/False>,
    error_code : <error_code>   // Error code if is_verified is False
}

Response Handling

  • If is_verified is True – the game should continue as the session token is verified.
  • If is_verified is False – the game should not be allowed to continue, as:
    • The game may be running on some other platform or
    • The game may have been tampered with.

Important Information

  • Depending on your requirement, if you wish to lock your game to a single instance or disable Macros, please email us at dev-support@now.gg.
  • To test your integration, please continue to the testing integration section.
  • We have also included the demo project for now.gg Shield, which you can find here.
×
Text copied to clipboard
Link copied to clipbord
Questions? Please reach out to us at dev-support@now.gg