++; } } } using UnityEngine; using System.Collections; public class player : MonoBehaviour { public static int score; // Use this for initialization void Start () { score=0; } // Update is called once per frame void Update () { }
: MonoBehaviour { // Use this for initialization Text scoretext; void Start () { scoretext = GetComponent<Text>(); } // Update is called once per frame void Update () { scoretext.text = "Score:" + player.score.ToString (); } }