
아래는 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는 최신버전으로 설치되어있습니다. 지웠다가 최신버전으로 다시 설치도 해봤는데요 오류가 안잡혀요
