【发布时间】:2021-08-15 23:36:42
【问题描述】:
我为 android 调制 3d 游戏。并评分剂量工作。最本质的是,在地图外移除汽车后,点数、最高成绩和硬币都被钉死了。 unity不报错的编译器是什么
using UnityEngine;
using UnityEngine.UI;
public class ScoreShow : MonoBehaviour
{
[SerializeField]
private Text topRecord;
void onEnable()
{
GetComponent<Text>().text = "Score: " + deletecar.countCars.ToString();
if (PlayerPrefs.GetInt("Score") < deletecar.countCars)
{
PlayerPrefs.SetInt("Score", deletecar.countCars);
topRecord.text = "Top:" + deletecar.countCars.ToString();
}
else
topRecord.text = "Top:" + PlayerPrefs.GetInt("Score").ToString();
}
}
代码的第 2 部分
using UnityEngine;
public class deletecar : MonoBehaviour
{
public static int countCars;
void Start()
{
countCars = 0;
}
void OnTriggerEnter(Collider other)
{
if (other.tag == "Player")
{
if (!Collisoinscars.lose)
{
countCars++;
PlayerPrefs.SetInt("Coins", PlayerPrefs.GetInt("Coins") + 1);
Destroy(other.gameObject);
}
}
}
}
【问题讨论】:
标签: c# visual-studio unity3d 3d