构建失败,出现异常-unity Adds

时间:2020-07-22 10:33:24

标签: c# unity3d

我做了一个简单的游戏,为了测试,我决定在那里添加一个广告。在导入带有广告的软件包之前,所有内容都可以正常编译,但是之后编译器开始出现错误。这是代码:

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

public class DrwLog : MonoBehaviour
{
    public GameObject pnel;
    public GameObject[] ColorButtons;
    public GameObject button;
    // Start is called before the first frame update
    void Start()
    {
        if (Advertisement.isSupported)
        {
            Advertisement.Initialize("*******", false );
        }
        Invoke("Bn", 10f);
        pnel.active = false;
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    public void Clicked(bool on)
    {
        if (on)
        {
            button.GetComponent<AudioSource>().Play();
        }
        else
        {
            button.GetComponent<AudioSource>().Stop();
        }
    }
    public void ColorChnge(int clr)
    {
        button.GetComponent<Image>().color = ColorButtons[clr].GetComponent<Image>().color;
    }
    public void PnelEnble()
    {
        if (!pnel.active)
        {
            pnel.active = true;
        }
        else
        {
            pnel.active = false;
        }
    }
    public void Bn()
    {
        if (Advertisement.IsReady())
        {
            Advertisement.Show("bn");
        }
    }
}

Unity Monetization-完整的附加组件名称。

0 个答案:

没有答案