Tuesday, 26 August 2014

How to integrate AdDuplex banner into your Unity game (part 2)

In part 1 I’ve explained how to add AdDuplex banner into your game. In part 2 I will show you a technique I use to enable/disable the AdDuplex banner from your game.

1.  When still in Unity add a new C# script to your game, name in Interop.cs and paste the following code into it:

2.  In game when you want to enable/disable the banner call Interop.DisableAdDuplex(); or Interop.EnableAdDuplex();

3.  After you build your Unity project and add the banner (as we have discussed earlier) open MainPage.xaml.cs file and add several lines of code to constructor:

replace
with

How to integrate AdDuplex banner into your Unity game (part 1)

AdDuplex is a cross-promotion network specifically targeted at Windows 8 and Windows Phone apps and games. It empowers developers to promote apps for free by helping each other.
And in case you’ve been living under a rock - you can now score some serious cash by advertising in AdDuplex Direct

Adding AdDuplex banner to your game is pretty much plain sailing. Here’s how:

1.  Open the build generated Visual Studio project and go to TOOLS->NuGet Package Manager->Package Manager Console

2.  Run this command in the console:
Install-Package AdDuplexWP8

3 .  Add a reference to the top of your MainPage.xaml file:

4.  Insert the ad control in between the DrawingSurfaceBackgroundGrid tags:

5.  Enter your AppID, position the control as you like

Thats it. Learn how to enable/disable the banner from inside of your game in part 2