ошибка в скрипте Unity Ads

Форум для самых маленьких, а так же тех, кому недосуг читать справку самостоятельно.

ошибка в скрипте Unity Ads

Сообщение kirya_355 01 июл 2018, 15:26

короче взял пример скрипта с сайта unity ads , но вылезла ошибка
Assets/scripts/UnityAdsButton.cs(47,45): error CS0246: The type or namespace name `ShowResult' could not be found. Are you missing an assembly reference?

вот код
Синтаксис:
Используется csharp

using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Advertisements;

[RequireComponent(typeof(Button))]
public class UnityAdsButton : MonoBehaviour
{
   
    Button m_Button;

    public string placementId = "rewardedVideo";
    public string action;

    void Start()
    {
        m_Button = GetComponent<Button>();
        if (m_Button) m_Button.onClick.AddListener(ShowRewardedAd);
if (PlayerPrefs.GetInt ("NoAds") != 1)
                 {
             if (Advertisement.isSupported)
                          {
        Advertisement.Initialize ("2578372", false);
              }
           else
        Debug.Log ("Platform is not supported");
                 }            
       
    }

    void Update()
    {
        if (m_Button) m_Button.interactable = Advertisement.IsReady(placementId);
    }

   

   
 public void ShowRewardedAd()
              {
                if (Advertisement.IsReady("rewardedVideo"))
                {
                  var options = new ShowOptions { resultCallback = HandleShowResult };
                  Advertisement.Show("rewardedVideo", options);
                }
              }

              private void HandleShowResult(ShowResult result)
              {
                switch (result)
                {
                  case ShowResult.Finished:
                    Debug.Log("The ad was successfully shown.");
                     switch (action)
                    {
                case "shop":
                   int i = PlayerPrefs.GetInt("allscore");
                    PlayerPrefs.SetInt("allscore",i+50);
           
                    break;
                    }
                    break;
                  case ShowResult.Skipped:
                    Debug.Log("The ad was skipped before reaching the end.");
                    break;
                  case ShowResult.Failed:
                    Debug.LogError("The ad failed to be shown.");
                    break;
                }
              }  
}
kirya_355
UNIт
 
Сообщения: 106
Зарегистрирован: 09 май 2018, 21:40



Вернуться в Почемучка

Кто сейчас на конференции

Сейчас этот форум просматривают: Google [Bot], Yandex [Bot] и гости: 22