How to work a real life timer?

What I am trying to do is bring basically real time into my game, but for it to “keep track” after the game is closed. The timer is going to be set for 30 minutes and after 30 minutes “blah blah” will happen, but if the player ends the game and starts up later it will show the new time, let’s say the timer is set and going and the player ends the game at 29 minutes and gets back on after 27 minutes and the timer’s new time will be 2 minutes remaining and continuing to count but if the player gets back 30+ minutes something will happen. The only timer I know how to do is the normal timer that restarts after the game is restarted.

Unity 5.3.1 Personal

Script: C#


Check out a nifty C# class called DateTime.

You’ll need to import the ‘System’ namespace in order to use this.

So, at the very top of your script, type:

using System;

Next, try this:

void Start()

From here I’m sure you can figure out a way to set a timer.

Best of luck!

Thank you so much, exactly what I needed.