Skip to content

Instantly share code, notes, and snippets.

@KiviMaker
Created March 24, 2018 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KiviMaker/b07b45ff8f99c7fdd26e178f1f15e259 to your computer and use it in GitHub Desktop.
Save KiviMaker/b07b45ff8f99c7fdd26e178f1f15e259 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 Text score1;
public float score;
public bool check = false;
// Use this for initialization
void Start()
{
score1.GetComponent<Text>();
score = 0;
}
// Update is called once per frame
void Update() {
if (check == false)
{
StartCoroutine(enumerator ());
score1.text = ("Score " + score);
Debug.Log(score);
Debug.Log(score1);
}
}
IEnumerator enumerator()
{
score = score + 0.01f;
yield return new WaitForSeconds(0);
check = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment