HOW TO USE THE UNITY ADVERTISING ADMOB PART 2
If you Want to Display Ads Click Button When you need a little kodingan for this command, ane will help agan to give kodingan bit in this command, the following is the code:
1. Create a new GameObject, named "Admob Manager". Then add Component Script with the name "MyAdmobBehaviour", contents:
1: using UnityEngine;
2: using System.Collections;
3: public class MyAdmobBehaviour : MonoBehaviour {
4: public void RequestInterstitial(){
5: AdmobVNTIS_Interstitial x = AdmobVNTIS_Interstitial._get ();
6: }
7: public void ShowAdmobIntersitial(){
8: AdmobVNTIS_Interstitial._showInterstitialImmediately ();
9: }
10: public void ShowAdmobBanner(){
11: AdmobVNTIS x = AdmobVNTIS._get ();
12: if (x != null) {
13: x.setMargins (0.1f, 0.0f);
14: AdmobVNTIS.Rules[] rules = new AdmobVNTIS.Rules[1];
15: rules [0] = AdmobVNTIS.Rules.ALIGN_PARENT_BOTTOM;
16: x.setRules (rules, 1);
18: }
19: }
20: }
2. To display the "Banner" live call function "ShowAdmobBanner", ato if its function would be called in a different class, you can call the function as follows :
GameObject.Find ("AdmobManager").GetComponent<MyAdmobBehaviour>().ShowAdmobBanner();
3. Do the same way to display the interstitial. Do not forget to call the function "RequestInterstitial()" first, then you can call the function "ShowAdmobIntersitial ()".
After this drag & drop MyAdmobBehaviour.cs toward writing button.
If you want to try out example with applications android that have appeared on his ads can Download Here
For Video Tutorial can visit in link :
Tidak ada komentar:
Posting Komentar