在我当前的 Unity 程序中,我想实现广告。当我运行游戏时,广告会在 Unity 编辑器中运行,但是当我尝试在 iPhone 7 或 iPad Air 上运行广告时,却没有广告出现。有人知道我做错了什么吗?using UnityEngine;using UnityEngine.SceneManagement;using UnityEngine.Advertisements;public class GameManager : MonoBehaviour{void Start(){ Advertisement.Initialize("Appstore-id");}bool gameHasEnded = false;public float restartDelay = 1f;public float addDelay = 1f;public GameObject completeLevelUI;public void CompleteLevel (){ completeLevelUI.SetActive(true); Invoke("ShowAdd", addDelay);}public void EndGame(){ if (gameHasEnded == false) { gameHasEnded = true; Debug.Log("Game over"); Invoke("Restart", restartDelay); }}public void ShowAdd(){ if (Advertisement.IsReady()) { Advertisement.Show (); }}void Restart(){ SceneManager.LoadScene(SceneManager.GetActiveScene().name);}}
2 回答
- 2 回答
- 0 关注
- 500 浏览
添加回答
举报
0/150
提交
取消