[Unity] Admob 광고 붙히기
1. 아래 링크에서 admob plugin를 다운받는다.
https://github.com/googleads/googleads-mobile-unity/releases/tag/v3.0.1
2. project->import package->custom package에서 다운받았던 admob plugin을 선택
3. 구글 에드몹에 가서 가입하고 id를 받아온다.
https://www.google.co.kr/admob/
4. 유니티에서 c# 스크립트를 선택하고 다음과 같이 입력하면 끝.
4-1. Hierarchy에서 create empty를 생성하고 c#을 추가시킨다.
using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;
public class Admob : MonoBehaviour {
string bannerId = "admob id";
string bannerFullId = "admob full id";
InterstitialAd interstitial;
// Use this for initialization
void Start () {
// small banner ads
BannerView banner = new BannerView(bannerId, AdSize.Banner, AdPosition.Bottom);
AdRequest request = new AdRequest.Builder().Build();
banner.LoadAd(request);
banner.Show();
//
// 전면광고
// Initialize an InterstitialAd.
interstitial = new InterstitialAd(bannerFullId);
// Create an empty ad request.
AdRequest requestAds = new AdRequest.Builder().Build();
// Load the interstitial with the request.
interstitial.LoadAd(requestAds);
}
// Update is called once per frame
void Update () {
}
public void OnClickAdmobFullAds() {
interstitial.Show();
}
}
':::::: STUDY :::::: > Unity' 카테고리의 다른 글
GPGS data storage limit (0) | 2017.02.01 |
---|---|
Unity에서 Android Log 찍는법 (0) | 2017.01.11 |
Preventing uGUI mouse click from passing through GUI controls (0) | 2016.06.23 |
[Unity] there are 2 audio listeners in the scene (0) | 2016.04.28 |
[Unity] Unity ads 붙히기 (0) | 2016.03.03 |