Difference between revisions of "Unity"

From Ad4Game Developers
Jump to: navigation, search
(Download iOS SDK)
(Include the A4GPubUnity.framework)
Line 55: Line 55:
 
<br>To include the A4GPubUnity.framework to your xcode project, you need to select your target project, and then go to '''Build Phases → Link Binary With Libraries''',  
 
<br>To include the A4GPubUnity.framework to your xcode project, you need to select your target project, and then go to '''Build Phases → Link Binary With Libraries''',  
 
then click on the '''+''' sign  '''→ Add Other''', and select the A4GPubUnity.framework saved on your computer.
 
then click on the '''+''' sign  '''→ Add Other''', and select the A4GPubUnity.framework saved on your computer.
 +
===<font color='#2D95DB'>Include the AdSupport.framework</font> ===
  
 
= <font color='#2D95DB'>Contact</font> =
 
= <font color='#2D95DB'>Contact</font> =

Revision as of 07:33, 15 August 2013


Contents

Android Unity

Publishers

Download Android SDK

Download the [Android SDK publishers for Unity]. Decompress the zip file and extract the files to your development computer.
The Android SDK for Unity is provided as two frameworks files (AndroidSDKPublisher.jar et A4GPublisherUnity.jar), making it easy to include in your Android project.

Setup the Unity Project

Create a ‘Plugins’ folder and within this create another folder called ‘Android’ (Assets­>Plugins­>Android).
Copy the AndroidSDKPublisher.jar and the A4GPublisherUnity.jar into this folder.
Build the project for Android and then go into the ‘Temp\StagingArea’ folder with your project folder and copy the AndroidManifest.xml file into the ‘Android’ folder.
This manifest file now needs to be edited to look like this:

Display Mobile Ads

You will create a C# file that will attach to a Unity GameObject as a script. The C# file need to be under the Assets folder.
You'll then need to call the loadTopAds or loadBottomAds (you can call the both methods to display two ads (one on the top, and the other on the bottom of the screen) methods in the Awake() function of an empty GameObject in your startup scene:

   
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject a4g = jc.GetStatic<AndroidJavaObject>("currentActivity"); a4g.Call("loadTopAds", "yourZoneID"); a4g.Call("loadBottomAds", "yourSecondZoneID");

Now, go to File ­>Build Settings ­>Player Settings, and change the Bundle Identifier to com.a4gpublisherunity.
Build the Unity project for Android platform and run it on your device to see the ads.

Display Android Editorials

To display Android Editorials inside your unity project, you need to use one of the three methods (you can use all of them) bellow:
1­- showA4GEditos : If you want to display the editorials once the activity's started.
2­- showA4GEditosWithStartTime : If you want to display the editorials after certain time.
3­- showA4GEditosWithStartAndEndTime : If you want to display the editorials after certain time and close them automatically after certain time.
4­- showA4GEditosOnClick : If you want to display the editorials when the user click on a button.

   
Note: The three first methods mentioned above are valid only if your project target android 3.0 or above, showA4GEditoOnClick is
valid from android 2.3 or above.

Advertisers

Download Android SDK

Download the [Android SDK advertisers for Unity]. Decompress the zip file and extract the files to your development computer.
The Android SDK for Unity is provided as two frameworks files (AndroidSDKTracker.jar et A4GTrackerUnity.jar), making it easy to include in your Android project.

Setup the Unity Project

Create a ‘Plugins’ folder and within this create another folder called ‘Android’ (Assets­>Plugins­>Android).
Copy the AndroidSDKTracker.jar and the A4GTrackerUnity.jar into this folder.
Build the project for Android and then go into the ‘Temp\StagingArea’ folder with your project folder and copy the AndroidManifest.xml file into the ‘Android’ folder.
This manifest file now needs to be edited to look like this:

You will then create a C# file that will attach to a Unity GameObject as a script. The C# file need to be under the Assets folder.
You'll then need to call the loadTrack method in the Awake() function of an empty GameObject in your startup scene:

   
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject a4g = jc.GetStatic<AndroidJavaObject>("currentActivity"); a4g.Call("loadTrack", "yourTrackerID");

Now, go to File ­>Build Settings ­>Player Settings, and change the Bundle Identifier to com.a4gtrackerunity.

iOS Unity

Publishers

Download iOS SDK

Download the [iOS SDK publishers for Unity]. Decompress the zip file and extract the files to your development computer.
The iOS SDK for Unity is provided as a single framework file (A4GPubUnity.framework), making it easy to include in your iOS project.

Include the A4GPubUnity.framework

Build your Unity project for iOS, then open the generated xcode project.
To include the A4GPubUnity.framework to your xcode project, you need to select your target project, and then go to Build Phases → Link Binary With Libraries, then click on the + sign → Add Other, and select the A4GPubUnity.framework saved on your computer.

Include the AdSupport.framework

Contact

If you've got questions, we've got answers! Please Contact Us at tech@ad4game.com with any technical queries.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox