using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class uiManager : MonoBehaviour {
public Text scoreText;
int score;
// Use this for initialization
void Start () {
score = 0;
}
void score_view()
{
score = move.score;
Debug.Log("uiManager Score:"+score);
scoreText.text = "Score:"+score;
}
// Update is called once per frame
void Update ()
{
score_view();
}
}
答案 0 :(得分:0)
如果您的GameObject处于活动状态,并且您的脚本已启用,则每帧调用一次更新 此外,你的游戏应该正在运行。
https://docs.unity3d.com/ScriptReference/MonoBehaviour.Update.html
您可以使用以下变量检查此状态:
this.gameObject.activeSelf
this.enabled