I’m having a problem with my UI text. I have a countdown timer text and Score text . The problem I am having is the zero is not showing up along with the score text . When I click on play the score text shows like this on the scene : Score : . The Score text should be showing this way Score : 0 and their is no errors showing up in the unity console . Here is my script :
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class GameManagerSingleton : MonoBehaviour
{
public static GameManagerSingleton instance = null;
public static int score;
private Text text;
void Awake()
{
text = GetComponent <Text> ();
score = 0;
if (instance != null && instance != this)
Destroy(gameObject); // Ensures that there aren't multiple Singletons
instance = this;
}
void Update()
{
text.text = "Score : " + score;
}
I would think that your text isn’t updated at all and that your text in the inspector is "Score : ". Could you add a Debug.Log("Score: " + score); in your Update routine to see in the console if the code is actually called.
I’ve add the Debug.Log("Score: " + score) in the update function and the number still didn’t show up in the scene.