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