2 回答

TA貢獻(xiàn)2016條經(jīng)驗(yàn) 獲得超9個(gè)贊
在我的情況下,畫(huà)布由于某種原因重疊了橫幅,我只是在PlayerSettings -> Resolution and Presentation中取消選中“ Render Over native UI ” ,現(xiàn)在它工作正常。

TA貢獻(xiàn)1796條經(jīng)驗(yàn) 獲得超4個(gè)贊
我通過(guò)銷(xiāo)毀 QuitAd 方法中的橫幅解決了這個(gè)問(wèn)題:
public void QuitAd(TypeOfAd typeOfAd)
{
switch (typeOfAd)
{
case TypeOfAd.Banner:
Debug.Log("Quiting Banner ad");
bannerAd.Destroy();
break;
case TypeOfAd.Interestitial:
Debug.Log("Quiting Interestitial ad");
Debug.LogError("QuitAd Interestitial Not Implemented");
break;
case TypeOfAd.RewardedVideo:
Debug.Log("Quiting RewardedVideo ad");
Debug.LogError("QuitAd RewardedVideo Not Implemented");
break;
}
}
然后我修改了 ShowAd 方法,在顯示橫幅之前加載它:
public bool ShowAd(TypeOfAd typeOfAd)
{
if (DataManager.instance.showAds)
switch (typeOfAd)
{
case TypeOfAd.Banner:
Debug.Log("Showing Banner ad");
LoadAd(TypeOfAd.Banner); //Every time the banner is asked to be shown it will try to load before being shown.
this.bannerAd.Show(); //Will be show after loading
return true;
case TypeOfAd.Interestitial:
Debug.Log("Showing Interestitial ad");
if (this.interstitialAd.IsLoaded())
{
this.interstitialAd.Show();
return true;
}
else
{
Debug.LogWarning("Trying to show InterstitialAd but it is not loaded");
//TBD: Automaitcally load?
}
break;
case TypeOfAd.RewardedVideo:
Debug.Log("Showing RewardedVideo ad");
if (this.rewardedVideoAd.IsLoaded())
{
this.rewardedVideoAd.Show();
return true;
} else {
Debug.LogWarning("Trying to show RewardedBasedVideoAd but it is not loaded");
//TBD: Automaitcally load?
}
break;
}
return false;
}
但是,我不知道這是否是一個(gè)正確的解決方案,因?yàn)槊看伪仨氾@示橫幅時(shí)都會(huì)執(zhí)行新的加載請(qǐng)求(在未顯示橫幅的場(chǎng)景之后)。
此外,這個(gè)“解決方案”只是針對(duì)同一目標(biāo)的不同方法,而不是原始方法的修復(fù)。
因此,如果有人知道為什么原始代碼不起作用,我將非常感謝分享這些知識(shí)。
- 2 回答
- 0 關(guān)注
- 161 瀏覽
添加回答
舉報(bào)