This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using TMPro; | |
public class CountDown : MonoBehaviour | |
{ | |
public float InstantiationTimer = 2f; | |
public float interval = 2f; | |
public int count = 0; | |
void Update() | |
{ | |
CreatePrefab(); | |
} | |
void CreatePrefab() | |
{ | |
InstantiationTimer -= Time.deltaTime; | |
if (InstantiationTimer <= 0) | |
{ | |
this.gameObject.GetComponent<TextMeshPro>().text = Convert.ToString(count++); | |
InstantiationTimer = interval; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment