Hello everyone,
I am having a little issue with displaying the score on scree.
When a game object is destroyed the player gets 10 points for each. The script I am currently using does not increment the score by 10 point. It only shows once and does not increment.
Please help, I am stuck with this.
Thanks in advance.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Bricks : MonoBehaviour {
private int count;
public Text countText;
// Use this for initialization
void Start () {
count = 0;
SetCountText ();
}
// Update is called once per frame
void Update () {
}
void OnCollisionEnter(Collision col){
Destroy (gameObject);
count = count + 10;
SetCountText ();
}
void SetCountText (){
countText.text = "Score :" + count.ToString ();
}
}