using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UIManger ; MonBehaviour
{
public UIManger _instance;
public Text scoreText; //UI 组件
public int score=0; //分数
Privare void Awake(){
_instance=this;
}
Private void Update() {
scoreText.text=score.ToString();
}
public void Addscore()
{
score+=1;
}
}
// 然后在你项目中的 消灭怪物的 函数中 写入
UIManager._instance.Addscore();