本文介绍了如何修复这个C#文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;

public class InterstitialAdScript : MonoBehaviour
{

    bool hasShownAdOneTime;

    void Start()
    {
        if (GameScript.isGameOver)
        {
            if (!hasShownAdOneTime)
            {
                hasShownAdOneTime = true;
                Invoke("showInterstitialAd", 60.0f);
            }
        }
    }

    public void showInterstitialAd()
    {
		 string adID = "ca-app-pub-";

      showInterstitialAd();

            //Stop Sound
            //

            Debug.Log("SHOW AD");
        }

    }

#if UNITY_ANDROID
        string adUnitId = adID;
    private static string adID;
    public object interstitialAd;
#elif UNITY_IOS
        string adUnitId = adID;
#else
        string adUnitId = adID;
#endif

   }





我的尝试:





What I have tried:

string adUnitId = adID;
private static string adID;
public object interstitialAd;





我不知道如何解决它... ...



I don't know how to fix it ... ...

推荐答案

string adUnitId = adID;

正在尝试解决仅限本地变量存在于 showInterstitialAd 方法中,它偶然包含一个递归循环。



您还获得了<$的声明c $ c>字符串adUnitId = adID; 在预处理器的所有三种情况下 #IF 子句;你应该在块之外放置一个副本,因为它总是会被生成。

is trying to address a local variable that only exists in the showInterstitialAd method, which incidentally contains a recursive loop.

You have also got declarations for string adUnitId = adID; in all three cases of your preprocessor #IF clauses; you should place a single copy outside the block, since it will always be generated.


这篇关于如何修复这个C#文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 00:57