Score wont display
I'm trying to update the score by one every few seconds but it wont work! Help Please!
using UnityEngine; using System.Collections; using UnityEngine.SceneManagement; using UnityEngine.UI;
public class UIManager : MonoBehaviour {
public Text scoreText;
public int score;
// Use this for initialization
void Start () {
score = 0;
}
// Update is called once per frame
void Update () {
}
void scoreUpdate (){
score++;
InvokeRepeating ("scoreUpdate", 1.0f, 0.5f);
scoreText.text= "Score:" + score;
}
public void Play(){
SceneManager.LoadScene ("TakeOff");
}
public void Pause(){
if (Time.timeScale == 1) {
Time.timeScale = 0;
}
else if (Time.timeScale==0) {
Time.timeScale = 1;
}
}
public void Menu(){
SceneManager.LoadScene("menu");
}
}
Comment
Your answer
Follow this Question
Related Questions
Health Script 2 Answers
when i reload the scene the score number remains the same and doesnt revert back to zero 1 Answer
In updating some score text, why should we use the Update function instead of separate functions? 0 Answers
Problem with player Score 1 Answer
Help making a high score with player prefs/displaying it 1 Answer