【发布时间】:2019-10-24 13:03:57
【问题描述】:
我有一个在内部和 alpha 上完全可以正常工作的构建,所以我终于上传到生产环境,现在我得到空引用异常错误。如果我从 Google Play 控制台“取消发布”游戏,它会将应用程序的内部测试版本放在我的手机上,一切都会正常运行。它们都是完全相同的版本。它们完全相同。不知何故,我把它放在生产轨道上正在重命名我的游戏对象。
我为 Logcat 打开了 android studio,这就是我打开应用程序时得到的正确结果。
2019-06-09 22:48:03.263 24428-24453/?
E/Unity: NullReferenceException: Object reference not set to an instance of an object.
at Playbutton.Start () [0x00000] in <00000000000000000000000000000000>:0
这是播放按钮的开始功能
private void Start()
{
coinsCollected = GameObject.Find("Coins Collected").GetComponent<TMP_Text>();
birdsLasered = GameObject.Find("BirdsLasered").GetComponent<TMP_Text>();
highScore = GameObject.Find("HighScore").GetComponent<TMP_Text>();
coinsCollected.text = "Coins Collected\n" + PlayerPrefs.GetInt("TotalCoins", 0);
birdsLasered.text = "Birds Lasered\n" + PlayerPrefs.GetInt("TotalBirds", 0);
highScore.text = "High Score: " + PlayerPrefs.GetInt("HighScore", 0).ToString();
}
Does GameObject.Find not work in production tracks somehow? Im totally baffled.
【问题讨论】:
-
你能分享更多关于你正在寻找的游戏对象的信息吗?
标签: unity3d google-play google-play-console