회원 로그인
|
UnityAds 유니티 광고(Unity Advertisement) 연동
UnityAds 유니티 광고(Unity Advertisement) 연동
:UnityAds버젼 5.5.x 이상에선 Servies에서 제공 |
http://www.unityads.co.kr
1. https://unity3d.com/kr/services/ads
2. UDN 로그인 (유니티 ID로 로그인)
3. ACQUIRE NEW USERS FOR YOUR GAMES 선택
4. 정보 입력 / 가입 / 관리자 페이지 생성
5. 게임 > 새 게임 추가
6. 플랫폼 선택 / 라이브 전인가요? 여기 클릭 / 이름 넣고 게임 추가 / 나이 제한 선택 > 계속
7. 유니티에서 Unity 애셋스토어 > UnityAds(v1.3.6) 설치
-Plugins와 Standard Assets 폴더에 설치됨
게임오브젝트 만들고 거기에 스크립트 붙임
트러블슈팅 잘 되던 것이 에러가 났을 때 UnityAds Asset 삭제 후 다시 임포트 |
게임오브젝트 만들고 거기에 스크립트 붙임
using UnityEngine; using System.Collections; using UnityEngine.Advertisements; public class UnityAds : MonoBehaviour { void Start () { // Initialize("게임ID",테스트모드 true/false) : 한번만 호출하므로 Start() 함수에 작성 Advertisement.Initialize("95309", false); } // 버튼으로 광고 표시 void Show() { // IsReady() : 광고 준비 여부 if (Advertisement.IsReady()) { Advertisement.Show(); } } // 코루틴으로 광고 표시 IEnumerator ShowCoroutine() { while(Advertisement.IsReady() == false) { yield return null; } Advertisement.Show(); } void OnGUI() { if(GUI.Button(new Rect(100,100,100,30), "광고 보기")) { //Show(); // 코루틴 사용(3가지 종류) // StartCoroutine("ShowCoroutine"); // IEnumerator e = ShowCoroutine(); // StartCoroutine(e); StartCoroutine(ShowCoroutine()); } } }*추가:광고를 봤는지 스킵했는지 확인
using UnityEngine; using System.Collections; using UnityEngine.Advertisements; public class UnityAds : MonoBehaviour { void Start () { // Initialize("게임ID",테스트모드 true/false) : 한번만 호출하므로 Start() 함수에 작성 Advertisement.Initialize("95309", false); } // 버튼으로 광고 표시 void Show() { // IsReady() : 광고 준비 여부 if (Advertisement.IsReady()) { Advertisement.Show(); } } // 코루틴으로 광고 표시 IEnumerator ShowCoroutine() { while(Advertisement.IsReady() == false) { yield return null; } // Advertisement.Show(); // Advertisement.Show(스트링, 클래스) ShowOptions showOption = new ShowOptions(); showOption.resultCallback = Callback; // 바로 못할 처리가 완료되어 결과나 나올 때 함수 호출 Advertisement.Show(null, showOption); } // 결과값 받기 void Callback(ShowResult result) { switch (result) { case ShowResult.Failed: // ad 실패 print("Failed ad"); break; case ShowResult.Finished: // ad 본 것이 성공이면 처리 print("Finished ad"); break; case ShowResult.Skipped: // ad 스킵 처리 print("Skipped ad"); break; } } void OnGUI() { if(GUI.Button(new Rect(100,100,100,30), "광고 보기")) { //Show(); // 코루틴 사용(3가지 종류) // StartCoroutine("ShowCoroutine"); // IEnumerator e = ShowCoroutine(); // StartCoroutine(e); StartCoroutine(ShowCoroutine()); } } }
댓글 0개
| 엮인글 0개
146개(3/8페이지)
번호 | 제목 | 글쓴이 | 조회 | 날짜 |
---|---|---|---|---|
유니티 강좌 모음(영문) | 푸딩뱃살 | 60294 | 2013.08.28 12:02 | |
유니티 경고, 에러 모음 (재정리 예정) [1+1] | 푸딩뱃살 | 71094 | 2013.08.12 00:09 | |
104 | [콘솔] 안드로이드 호환성 설정 - AndroidManifest.xml | 푸딩뱃살 | 1561 | 2016.01.10 16:29 |
103 | [소셜] 구글 개발자 콘솔 요약 | 푸딩뱃살 | 2074 | 2016.01.08 15:49 |
102 | [유니티] Rich Text (리치 텍스트) | 푸딩뱃살 | 3032 | 2016.01.07 11:32 |
101 | [스트립트] 전처리기 | 푸딩뱃살 | 3838 | 2016.01.05 11:36 |
100 | [소셜] 안드로이드 inApp(인앱) 처리 | 푸딩뱃살 | 1422 | 2016.01.05 11:30 |
99 | [소셜] Push (문자 알림 서비스) | 푸딩뱃살 | 1821 | 2016.01.04 11:50 |
98 | [소셜] 안드로이드 inApp(인앱) 등록 | 푸딩뱃살 | 1582 | 2016.01.04 10:46 |
97 | [유니티] Asset Bundle (애셋 번들) | 푸딩뱃살 | 4697 | 2015.12.30 11:53 |
96 | [소셜] AdMob 광고 연동 | 푸딩뱃살 | 1669 | 2015.12.30 01:19 |
95 | [소셜] Google Play Games 리더보드 | 푸딩뱃살 | 2544 | 2015.12.29 16:00 |
94 | [소셜] 유니티 구글 게임 서비스 연동 | 푸딩뱃살 | 2298 | 2015.12.29 10:59 |
93 | [소셜] 구글 플레이 서비스 (Google Play Service) | 푸딩뱃살 | 2385 | 2015.12.28 10:16 |
>> | [소셜] UnityAds 유니티 광고(Unity Advertisement) 연동 | 푸딩뱃살 | 2809 | 2015.12.24 12:09 |
91 | [유니티] 안드로이드 빌드 | 푸딩뱃살 | 5917 | 2015.12.21 10:41 |
90 | [스트립트] 프레임 함수-유니티가 시작되면서 호출되는 기본적인 함수 | 푸딩뱃살 | 4517 | 2015.12.14 00:22 |
89 | [유니티] Trail Renderer (트레일 렌더러) | 푸딩뱃살 | 2784 | 2015.12.11 17:25 |
88 | [유니티] Character Controller (캐릭터 컨트롤러) | 푸딩뱃살 | 3130 | 2015.12.10 14:18 |
87 | [유니티] Materials (매터리얼) 예제 | 푸딩뱃살 | 2374 | 2015.12.09 12:17 |
86 | [유니티] Light (라이트) | 푸딩뱃살 | 2966 | 2015.12.09 10:52 |
85 | [유니티] Physics.Linecast() / Physics.Raycast() | 푸딩뱃살 | 3984 | 2015.12.08 12:56 |