- Home /
how can i add in-game time limit from the menu
how can i add in-game time limit from the menu? using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;
public class Timer : MonoBehaviour {
public float timer = 0f;
public Text lepta;
public InputField TimeText;
// Use this for initialization
void Start ()
{
// lepta = GetComponet(Text);
}
// Update is called once per frame
void Update () {
timer -= Time.deltaTime;
lepta.text = timer.ToString("f0");
if (timer <= 0)
{
}
}
}
time-pardgma.png
(499.6 kB)
Comment
Best Answer
Answer by watercat · May 20, 2018 at 05:20 PM
I found it
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Timer : MonoBehaviour {
public float timer = 0f;
public Text lepta;
// public InputField TimeText;
// Use this for initialization
void Start ()
{
// lepta = GetComponet(Text);
}
// Update is called once per frame
void Update () {
timer -= Time.deltaTime;
lepta.text = timer.ToString("f0");
if (timer <= 0) { }
}
public void textdx (float Newtext)
{
timer = Newtext;
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612162603im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
animating and moving isn't working... 1 Answer
How to refresh timeline after update to AnimationClip 1 Answer