Skip to content

Instantly share code, notes, and snippets.

@WakkyFree WakkyFree/AddScore.cs
Last active Apr 3, 2018

Embed
What would you like to do?
Unity script to add score
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class AddScore : MonoBehaviour {
private int score = 0;
public Text scoreText;
// Use this for initialization
void Start () {
score = 0;
scoreText.text = "0";
}
// Update is called once per frame
void Update () {
}
void OnCollisionEnter(Collision collision) {
if (collision.gameObject.tag == "Wall") {
score += 100;
scoreText.text = "" + score.ToString();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.