커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
"광고 보기에 실패했습니다." 라고 뜹니다.
undefined주차
북마크
박*윤
댓글
3
추천
0
조회수
13
조회수
13
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


"광고 보기에 실패했습니다." 라고 뜹니다.


"Advertisement.IsReady()" 오류 생겨서 q&a 보니깐 Advertisement 버젼을 3.7.5 로 변경하라고 해서 변경 하고 난 뒤 에러 생기지 않아서

빌드 해보니 결과 값이 "광고 보기에 실패했습니다." 라고 로그가 생깁니다.


강의 내용 중에

Ads Package 에서 "You are up-to-date" 나와야 한다고 했는데

3.7.5 버전을 설치 하면 위에 내용이 생성 되지 않고 최신 4.4.2 버전일 때 생성하면 생깁니다.


그리고 3.7.5 버전에서는 "resultCallback"에서 경고가 뜹니다.





스파르타 즉문즉답



스파르타 즉문즉답스파르타 즉문즉답



작성한 코드 및 에러 메세지

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Advertisements;


public class adsManager : MonoBehaviour
{
    public static adsManager I;


    string adType;
    string gameId;
    void Awake()
    {
        I = this;


        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            adType = "5247869";
            gameId = "5247868";
        }
        else
        {
            adType = "5247869";
            gameId = "5247868";
        }


        Advertisement.Initialize(gameId, true);
    }


    public void ShowRewardAd()
    {
        if (Advertisement.IsReady())
        {
            ShowOptions options = new ShowOptions { resultCallback = ResultAds }; // 여기서 resultCallback 경고가 뜹니다.
            Advertisement.Show(adType, options);
        }
    }


    void ResultAds(ShowResult result)
    {
        switch (result)
        {
            case ShowResult.Failed:
                Debug.LogError("광고 보기에 실패했습니다.");
                break;
            case ShowResult.Skipped:
                Debug.Log("광고를 스킵했습니다.");
                break;
            case ShowResult.Finished:
                // 광고 보기 보상 기능 
                gameManager.I.retryGame();
                Debug.Log("광고 보기를 완료했습니다.");
                break;
        }
    }


    // Start is called before the first frame update
    void Start()
    {
        
    }


    // Update is called once per frame
    void Update()
    {
        
    }
}





취소
 공유
취소
댓글 0
댓글 알림
나의얼굴