Skip to content

Instantly share code, notes, and snippets.

@istar0me
Last active October 23, 2018 05:51
Show Gist options
  • Save istar0me/ef785fbdd858f9e05f2b111a8defe599 to your computer and use it in GitHub Desktop.
Save istar0me/ef785fbdd858f9e05f2b111a8defe599 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Score : MonoBehaviour
{
public GameObject myCube;
public Text scoreText;
private int score = 0;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
if (myCube != null)
{
if (myCube.transform.position.y < -10)
{
// Debug.Log("Finished");
Destroy(myCube);
score += 10;
scoreText.text = score.ToString();
}
}
}
}
@blackstuend
Copy link

I like your article<3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment