Skip to content

Instantly share code, notes, and snippets.

@PrashantUnity
Created August 7, 2022 18:25
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 PrashantUnity/1d33795a91bee28707758bd1211acb13 to your computer and use it in GitHub Desktop.
Save PrashantUnity/1d33795a91bee28707758bd1211acb13 to your computer and use it in GitHub Desktop.
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