@ftnara ,Here is a simple example you can use for most timed purposes without going into the IEnumerator’s and that side of the logic.
using UnityEngine;
using System.Collections;
public class SimpleTimer : MonoBehaviour {
public float myTimer;
public bool timesUp;
void Start() {
timesUp = false;
}
void Update() {
myTimer -= Time.deltaTime;
if (myTimer <= 0) {
timesUp = true;
myTimer = 0;
}
if (timesUp) {
// Do Something
}
}
}
Basically here we are just subtracting from our myTimerfloat via the Time.deltaTIme method. This will allow us by default to subtract 1 from the timer every second. Note, that if you change the Time.timeScale this may affect this logic.
Let me know if something isnt clear or if you need help.