Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // file: CountdownTimer.cs
- using UnityEngine;
- using System.Collections;
- public class CountdownTimer : MonoBehaviour {
- private float secondsLeft = 10f;
- private void OnGUI(){
- if( secondsLeft > 0)
- GUILayout.Label("Countdown seconds remaining = " + (int)secondsLeft );
- else
- GUILayout.Label("Countdown has finished");
- }
- private void Update(){
- secondsLeft -= Time.deltaTime;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment