Utility Module for Unity

With the now.gg Utility module for Unity, you can implement the now.gg Utility functions within your game on Unity.

To implement the Utility module:

  1. Download and Import the now.gg Utility module Unity module.
  2. Implement now.gg Utility module to your project.

Download and Import the Module

The now.gg Utility module for Unity is included as a Unity package file nowgg-utility.unitypackage.

Add the module to your Unity project:

  1. Download the package containing the latest version of now.gg Utility module for Unity.
  2. After you have downloaded the module, import it into your Unity project. To do this:
    • Click on Assets > Import Package > Custom Package, as shown below:
    • Select nowgg-utility.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 at the root of the Assets folder.

Note: Please do not modify the NowGGSdk folder, as it contains all the assets related to now.gg Utility module.

Implement Utility Module

The following sections illustrate the implementation of the now.gg Utility module.

Once the now.gg Utility Module has been imported; you can now implement it.

Start by creating a class that contains the now.gg Utility module implementation and attach it to a game object that you can use to call the Utility functions.

The Utility module includes the following methods:

  • Device Type
    Using this method, you to detect the user’s device, e.g., phone, tablet, desktop, etc.
  • Open URL
    Using this method, you can open a URL in a new browser window on the user’s device.
  • Platform Detection
    Using this method, you can ensure that your app is running on now.gg platform.

References

1. Device Type

The GetDeviceType() method lets you detect the user’s device type.

The device types include:

  • SMARTPHONE
  • TABLET
  • DESKTOP
  • UNKNOWN (Shown if the user’s device type cannot be detected)

To get the device type, call the GetDeviceType() method, as illustrated below:

    DeviceType deviceType = NowGGUtilitySdkManager.GetInstance().GetDeviceType();

Reference – You can refer to the GetDeviceType reference here.


2. Open Url

The OpenUrl() method lets you open a URL in a new browser window of the user’s device. The following sample code illustrates this implementation.

    NowGGUtilitySdkManager.GetInstance().OpenUrl("<your_url_here>");

Reference – You can refer to the OpenUrl() reference here.


3. Platform Detection

The IsRunningOnNowGG method enables you to identify if your application is running on the now.gg platform or not. The following sample code illustrates this implementation.

    NowGGUtilitySdkManager.GetInstance().IsRunningOnNowGG()
Note: Returns true, If the application is running on now.gg.

Reference – You can refer to the IsRunningOnNowGG() reference here.


×

Table of Contents

Utility Module for Unity

Table of Contents

Document Rev. 1.0

Text copied to clipboard
Link copied to clipbord
Questions? Please reach out to us at dev-support@now.gg