Countdown timer for reward system

Hi, does anybody know on how to create a countdown timer in which it will grant a reward for the player when the timer runs out.
For example, at first the timer will be 5 mins, after acquire the reward, the timer will become 10 mins, next 1 hour, and until 24 hour. When it hit 24 hours, the next timer will also locked at 24 hours.

Any solutions on this?

Thank you very much

Hi mate,

Have a look at this tutorial to get a timer system working:

To use multiple times you could set the timeRemaining value to the highest time you want to use and then set conditions at each of the intervals where you want something to happen.

Something like…

If (timeRemaining < 10)
//...doSomething();

if (timeRemaining < 5)
// ...dosomethingElse();

Hi james,

I finally used dateTimeutil.currentunix for the time, but since it only displayed in seconds, is it possible to display it in this format → hours : minutes : seconds

thank you

suppose to late to help you now, but for anyone who finds this:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RewardScript : MonoBehaviour
{
private void Awake()
{
Debug.Log(System.DateTime.Now.TimeOfDay.Minutes);

Debug.Log(System.DateTime.Now.TimeOfDay + new TimeSpan(0,10,0));
}
}

Please don’t necro posts. Closing.

1 Like