Difference between revisions of "Unity"
(→Display Mobile Ads) |
(→Display Mobile Ads) |
||
Line 16: | Line 16: | ||
screen) methods in the '''Awake()''' function of an empty GameObject in your startup scene: | screen) methods in the '''Awake()''' function of an empty GameObject in your startup scene: | ||
<dd><font color='blue'>AndroidJavaClass</font> jc = <font color='blue'>new AndroidJavaClass</font>(<font color='magenta'>"com.unity3d.player.UnityPlayer"</font>); | <dd><font color='blue'>AndroidJavaClass</font> jc = <font color='blue'>new AndroidJavaClass</font>(<font color='magenta'>"com.unity3d.player.UnityPlayer"</font>); | ||
− | + | <font color='blue'>AndroidJavaObject</font> a4g = jc.GetStatic<<font color='blue'>AndroidJavaObject</font>>(<font color='magenta'>"currentActivity"</font>); | |
− | + | a4g.Call(<font color='magenta'>"loadTopAds"</font>, <font color='magenta'>"yourZoneID"</font>); | |
− | + | a4g.Call(<font color='magenta'>"loadBottomAds"</font>, <font color='magenta'>"yourSecondZoneID"</font>); | |
= <font color='#2D95DB'>Contact</font> = | = <font color='#2D95DB'>Contact</font> = |
Revision as of 06:23, 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:
AndroidJavaObject a4g = jc.GetStatic<AndroidJavaObject>("currentActivity"); a4g.Call("loadTopAds", "yourZoneID"); a4g.Call("loadBottomAds", "yourSecondZoneID");
Contact
If you've got questions, we've got answers! Please Contact Us at tech@ad4game.com with any technical queries.