Created
December 19, 2017 07:56
-
-
Save Curookie/a24bf778adb1df7017f5a12afadb8bc0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.UI; | |
using System.Collections; | |
public class ScoreManager : MonoBehaviour | |
{ | |
public static int score; // The player's score. | |
Text text; // Reference to the Text component. | |
void Awake () | |
{ | |
// Set up the reference. | |
text = GetComponent <Text> (); | |
// Reset the score. | |
score = 0; | |
} | |
void Update () | |
{ | |
// Set the displayed text to be the word "Score" followed by the score value. | |
text.text = "Score: " + score; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment