Documentation

Unity SDK integration should take no more than 10 minutes of your time, it really is that easy!
Our walkthrough goes through everything step-by-step to get the AdInMo SDK working with your game project within Unity.

If you have any questions, contact us at support@adinmo.com

Before you can begin, you will need to create an AdInMo Developer account. Once you have registered an account you will be taken to your Developer dashboard. From here you will be able to create games, see impressions and more.

A PayPal account is required as this is the payment method we use to pay you. For more information on payments and earning money see our ‘Getting Started’ page.

Already have a Developer account? Skip to Creating a Game to get started.

1. From the AdInMo navigation menu click ‘Sign Up‘ or click here. Click the ‘Sign Up‘ button on the top right of the page.

2. Fill the form with your details. Once completed, click ‘Sign Up’ to create your new developer account.

 A Game is a representation of your game within AdInMo. A game can support multiple placements, each placement is an object in your game which you want to display an advertisement on. Placements must contain a Unity 2D texture that will be replaced with an advertisement.

During this process you will create a Game Key and Placement Key that are required to work with the AdInMo SDK.

It is important that you keep Game Keys and Placement Keys private and do not share them with anyone.

1. Log in to AdInMo with your developer account if you have not already done so and you will be taken to the developer dashboard.

2. Click ‘Add Game‘ to create a new game.

3. Fill the form with details that are relevant to your game and click ‘Submit’.

4. Click ‘view’ next to the game you just created, this will display detailed information about your game.

5. The name of your game is displayed at the top of the screen, followed by the Game Key for your game. This key will be needed later in the ‘Unity Editor’ section of this walkthrough.

A Placement is a place within your game that will contain a Unity 2D texture that will be replaced with an advertisement, for example a billboard in a city environment.

A game can support multiple placements that can be organised into groups. To show the same advertisement across different placements, group the placements within the same group.

For this part of the walkthrough you will need to have an existing game. If you don’t have an existing game, please refer to the previous section.

It is important that you keep Game Keys and Placement Keys private and do not share them with anyone.

1. From the developer dashboard, find the game you want to create a placement for and select ‘view‘.

2. Under Placements, click ‘New Placement‘.

3. On this page you will see a form with different fields. Fill out the form with the relevant information and click ‘Submit‘.

  • Friendly Reference Name: a name that will be used to reference the placement key specific to this placement.
  • Status: determines if the placement key will serve images, “active” will serve images and “paused” will temporarily deactivate your placement key in real time.
  • Closest Aspect Ratio: the aspect ratios supported by the SDK, please choose the aspect ratio closest to your texture. For more information on supported aspect ratios on our ‘Quick Start Guide’.
  • Group: placements within the same group will have images from the same advertiser campaign, you can support up to 4 groups.

4. You have successfully created a placement! To create more placements, follow the previous steps in this section. Click ‘view‘ next to the placement for more details.

5. The Friendly Reference Name will be displayed at the top of the screen, followed by the Placement Key. There are also options to modify the placement if you wish to do so.

6. The Placement Key is required in later steps of the walkthrough. Continue to the next section.

It is important that you keep Game Keys and Placement Keys private and do not share them with anyone.

Downloading the AdInMo SDK is simple and easy. Just follow the steps below to download the SDK, you can also view the release notes that has information on every SDK release up to date. 

If you already have the latest AdInMo SDK, you can skip to the next section: Unity Editor.

1. Navigate to the SDK download page by hovering over ‘Resources‘ on the navigation menu and clicking ‘Download SDK‘ or click here.

2. Click the ‘Download SDK‘ button to download the AdInMo SDK.

Importing SDK to Unity

1. Open your project within Unity, oldest supported Unity version 2017.1.5f1.

2. Navigate to the main menu, click ‘Assets‘ followed by ‘Import Package‘ and ‘Custom Package‘.

3. Select the AdInMo unity package you downloaded in the previous section, ‘Download SDK’.

4. Ensure all the assets are selected and click ‘import‘.

AdInMo Manager

An example scene is available with the SDK to use as a reference, from the assets window select ‘AdInMo’, ‘Example’, and open ‘ExampleImage.unity’.

1. Once you have imported the unity package you should now see a folder called ‘AdInMo’ in your assets window.

2. From assets, click into ‘AdInMo‘ and then ‘Prefabs‘. Here you should see a prefab called ‘AdInMo Manager‘.

3. Click and drag the ‘AdInMo Manager‘ prefab into your scene’s hierarchy.

4. If you are creating an internal Unity ‘Release’, please check ‘Development Build‘ within AdInMo Manager to ensure no false information is being sent to our servers.

Please note, you will not be able to see impressions using a development build.

Adding Game Key to Unity

These steps require you to have a Game Key.

It is important that you keep Game Keys and Placement Keys private and do not share them with anyone.

Navigate to the AdInMo developer dashboard and click ‘view‘ next to the game you want to add advertisements to and the Game Key will be displayed at the top of the game page

If you haven’t created a game on the AdInMo website yet, follow the steps in the Creating a Game section of the walkthrough.

1. Select ‘AdInMo Manager’ from your scene’s hierarchy and navigate to the inspector window.

2. Copy the Game Key for your game and paste it into the ‘Game Key’ field within the Inspector.

Adding AdInMo Component

This step requires you to have at least one game object in your scene that will be used as a placeholder for advertisements – this can be an image, quad or sprite.

1. Create or use an existing game object and select it in the scene hierarchy and navigate to the inspector window.

2. From the inspector, click ‘Add Component‘ on the game object you want to add advertisements to.

3. Using the search feature, search and select ‘AdInMo Texture‘. This will add the component to your game object.

Adding a Placement to Unity

These steps require you to have a Placement Key.

It is important that you keep Game Keys and Placement Keys private and do not share them with anyone.

Navigate to the detailed view of your game from the developer dashboard by clicking ‘view’ next the placement you want to use and the Placement Key will be displayed at the top of the page.

If you haven’t created a placement for your game yet, follow the steps in the Creating a Placement section of the walkthrough.

1. Select the game object in the hierarchy that has the AdInMo Texture component outlined in the previous steps.

2. From the inspector, paste in your Placement Key in the relevant field.

3. Please note sharing the same placement key between multiple AdInMo texture objects will result in the same texture being shown on all of those objects.

4. To ensure your placement is large enough to generate revenue, check the ‘Debug Size Threshold‘ in AdInMo Manager, in the inspector window.

A border will appear around your placement. Green means you are able to generate revenue from your placement. Red means your placement is currently too small.

Finished!

That’s it! You can now run your project within Unity and view advertisements.

A few things to note:

  • To maximize revenue, advertisements are cycled every several seconds automatically.
  • From your developer account, you will not see impressions when running development builds or from within the Unity Editor as they are not recorded in development or debug mode.
  • Texture is replaced at run-time, as it is an asynchronous web request. This means the original texture will display until the new one has been downloaded.

If you have any issues with the AdInMo SDK check our FAQ page to find a solution or contact support at support@adinmo.com

What’s Next?

Check out the Advanced section below to further the AdInMo SDK within your project. This is entirely optional and is not a requirement of the SDK.

Questions or Comments?

We’re always looking to improve. Feel free to reach out with any questions or comments you may have at support@adinmo.com

From here you can add more functionality to the AdInMo SDK within your game. This section contains a range of functions that you can add and will require editing C# scripts.

Each function is contained within a code block with an explanation to its functionality.

Extra Revenue

Between levels, call the function below to earn extra revenue. See the example scene called ExampleDialog.unity to see how to call it and register a callback to know when this dialog is done.

AdinmoManger.ShowDialog()

Callback Function

For added control, there is a callback function you can register. This is useful for hiding an object until the replacement textures have been downloaded and applied, thus avoiding a visual pop:

AdinmoManager.SetOnReadyCallback()

Your delegate function must be of the form:

void MyDelegate( string message );

Modify Background Colour

Sometimes you will need to modify your background to match the background colour of the advertisement texture.

To assist, you can call the following function to get the border/background RGB colour of the downloaded replacement texture:

Color AdinmoTexture.GetBorderColor()

Rotate Textures

You can rotate which textures are displayed on which Placements by calling the following function, e.g. between levels.

void AdinmoManager.CycleTextures()

Temporarily Disable AdInMo Processes/Traffic

If you want to temporarily disable all AdInMo processing and network traffic, you can call:

AdinmoManager.Pause()

To resume normal operations, call:

AdinmoManager.Resume()

Join Our Mailing List to Download

Follow the link to download the success story!