Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using TMPro;
- public class TextMeshTimer : MonoBehaviour {
- public float startingTime;
- private Texture theText;
- private TextMeshPro m_Text;
- // Use this for initialization
- void Start () {
- m_Text = GetComponent<TextMeshPro>();
- }
- // Update is called once per frame
- void Update () {
- // Subtract Timer to 0
- startingTime -= Time.deltaTime;
- m_Text.text = "" + Mathf.Round(startingTime) + "ft";
- // If the timer is 0, keep the timer displayed as 0.
- if (startingTime <= 0) {
- m_Text.text = "0ft";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement