我在控制台中不断收到此错误:Assets/Scripts/ScoreScript.cs(37,25): error CS0029: 无法将类型“int”隐式转换为 UnityEngine.UI.Text这是我的代码:public class ScoreScript : MonoBehaviour{ public static int score = 0; public Text scoreText; private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Score") { scoreText.text = (++score).ToString(); Destroy(collision.gameObject); return; } else if (collision.tag == "Obstacle") { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex); scoreText = 0; } }}
- 1 回答
- 0 关注
- 1593 浏览
添加回答
举报
0/150
提交
取消