Hello! Help to create a timer for 1 hour per unit; you need an action to happen every hour.
int aTimer = Time.deltaTime; if(aTimer >= 3600){//выполняем действие и обнуляем таймер aTimer =0;} float aTimer=3600f; void Update() { if(aTimer <=0f) { //действие aTimer =3600f; } else aTimer -= Time.deltaTime;//Time.unscaledDeltaTime } or
void Start() { StartCoroutine(OneHour()); } IEnumerator OneHour() { YieldInstruction yi = new WaitForSeconds(3600f); while (true) { yield return yi; //действие } } Source: https://ru.stackoverflow.com/questions/700589/
All Articles