Question by
importguru88 · May 18, 2016 at 06:49 PM ·
scripting problemerrorsingletonwarning
warning CS0414: The private field `GameManagerSingleton.text' is assigned but its value is never used
I am having problem with my Score System . When I click on play the text Score is displaying on the screen incorrectly like this Score : . I need the score to display on the scene like this Score : 0 the way I have coded the script . I also gotten and this warning message CS0414: The private field `GameManagerSingleton.text' is assigned but its value is never used . I don't know what this means. 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;
Debug.Log("Score: " + score);
}
Comment