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:
Shield Module for Unity is included as a Unity package file nowgg-shield.unitypackage
.
Add the Shield module to your Unity project:
nowgg-shield.unitypackage
that you previously downloaded.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.
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:
This section contains the steps to integrate the Shield Module.
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
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.
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.
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 }
is_verified
is True – the game should continue as the session token is verified.is_verified
is False – the game should not be allowed to continue, as:
目录
目录
文档版本 1.0