커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
AdsManager 스크립트 오류 관련 질문입니다.
undefined주차
북마크
박*용
댓글
3
추천
0
조회수
20
조회수
20
답변 완료

아래는 AdsManager.cs 코드입니다.



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 = "Rewarded_iOS";

      gameId = "iOS 아이디";

    }

    else

    {

      adType = "Rewarded_Android";

      gameId = "Android 아이디";

    }


    Advertisement.Initialize(gameId, true);

  }


  public void ShowRewardAd()

  {

    if (Advertisement.IsReady())

    {

      ShowOptions options = new ShowOptions { resultCallback = ResultAds }; // // resultCallback 부분과 IsReady() 부분이 정의 되지 않았다고하는데요 어떻게 해야하나요?

      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:

        // 광고 보기 보상 기능 

        Debug.Log("광고 보기를 완료했습니다.");

        break;

    }

  }

}






작성한 코드 및 에러 메세지

Assets\Scripts\AdsManager.cs(34,53): error CS0117: 'ShowOptions' does not contain a definition for 'resultCallback'Assets\Scripts\AdsManager.cs(32,27): error CS0117: 'Advertisement' does not contain a definition for 'IsReady'


두개가 정의되지 않았다고합니다. 유니티 advertisement는 최신버전으로 설치되어있습니다. 지웠다가 최신버전으로 다시 설치도 해봤는데요 오류가 안잡혀요




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