Skip to content

Unity Advanced

We will guide you through the steps involved in integrating GreedyGame SDK in Unity using the GreedyGame Plugin.

Update your AndroidManifest.xml

Add the following <activity> declaration inside <application> tag of the Manifest.


Also, note the highlighted line where you can change the orientation of the screenOrientation property based on which orientation you want to open the engagment. All the allowed values can be found in Android Documentation

Adding Permissions

GreedyGame SDK needs the following permissions to work with.

Mandatory permissions

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>

Optional permissions

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>


ACCESS_COARSE_LOCATION permission will help improving the revenue because of doing better ad targetting.

Creating Ad Units

Adunits are ad assets that are rendered as a native component to the app.

Follow the below steps to create an Ad Unit ID.

  • Goto Integration Panel
  • Select an App you have created previously.
  • Click on Create Unit inside the Ad units in app Card.
  • Enter all the fields and click Save.


Follow the same procedure to create multiple Ad Units inside the app.

Best practices about the Unit Dimensions can be found under Best Practices section.

Importing GreedyGame Native Ads SDK For Unity

Download the GreedyGame Unity SDK

Download Plugin

Import Unity Package Inside current-sdk folder Open the downloaded SDK folder from github. Go to 'current-sdk' folder and import the package to unity. Assets > Import > Import Custom Package

Make sure you have atleast one scene added to your Build Settings before proceeding to the next step.

Import Google Mobile Ads SDK for Unity

If you don't have Google Mobile Ads SDK for Unity already integrated download it here. Import the package Assets > Import > Import Custom Package. Google Mobile Ads SDK is a mandatory requirement for GreedyGame SDK

Initializing GreedyGame SDK

Create a new C# Script and add the following code snippet inside Start() method

DontDestroyOnLoad (this.gameObject);
if (RuntimePlatform.Android == Application.platform || RuntimePlatform.IPhonePlayer == Application.platform) {
    GGConfig adConfig = new GGConfig ();
    adConfig.setGameId (AppId);
    adConfig.setListener (new GreedyAgentListener ());
    GGUnitConfig adUnitConfig = new GGUnitConfig ("slot-123", defaultTexture, true, false);
    adConfig.addUnit (adUnitConfig);
    adConfig.enableCoppa (enableCoppa);
    GreedyGameAgent.Instance.Init (adConfig);

Create a GGConfig object

  • adConfig.setGameId (AppId) : AppId (string) is the id of the app that was created.
  • adConfig.addUnit (adUnitConfig) : create GGUnitConfig for each unit that you created and add it using addUnit API or addUnitList API.
  • adConfig.enableCoppa(enable) : enable (boolean) to enforce COPPA regulations

Setting Ad Listener

Create a class implementing GGAdListener and set it using the setListener API.

Methods Definition
onAvailable(adId) SDK fetched an ad
onUnavailable() Failed to fetch next ad
onError(error) SDK not able to initialize. Check the error message.

Initialize GreedyGame using the following API


Rendering Ads

Identifying/Creating potential ad spots

First step in rendering GreedyGame Ads is identifying which object needs to be used for displaying ads. You can choose any plane surface in your game like billboards or walls in the street etc. for displaying ads. While choosing make sure that these units are visible to the user and are placed at interesting places inside the game.

While selecting an object or creating an object for ad rendering, please keep in mind that GreedyGame SDK needs an object with mesh/canvas/sprite renderer to display ads.

Registering for Ad Rendering

Once you have idenified/created a game object add a CS script to the object and add the following snippets to the script.

In Start() function

GreedyGameAgent.RegisterGameObject("slot-123", this.gameObject);

In Destroy() function


Test Ads

Now you have successfully integrated with GreedyGame Native Ads now is the time to test the integration.

GreedyGame recommends an easy way to test the ads by following the below steps

  • Goto Integration Panel
  • Select an App in which you want to check the test ads.
  • Click SCAN QR under the test Ads section and follow the stpes mentioned to get the test ads.

Going Live

You have successfully integrated GreedyGame SDK and verified the testing flow with Test Ads section. Now follow the below steps to start earning revenue.

  • Goto Integration Panel
  • Select the App which you want to make Live.
  • Click GO LIVE under Publish section and you will get a message Your request has been received and live traffic will be started in 48 hours.
  • You will start making money once the status changes to APP IS LIVE under publish section.


you have gone live do not click on the production ads for testing. Always go to the Test Ads section and Test your integration.