I’ve looked a bit in the scripting reference manual, especially around the Time class. I’m looking to find a way to get the current real life time, for example the time of the clock on the computer, like 14:34, or even just time of the day in seconds. All I could found was “time since game start”, which is not what i want. Any ideas?
Don’t forget that you also have the Mono system libraries at hand (mostly an implementation of .NET 3.5). There is a structure under the System namespace called DateTime, with it a member called Now which returns a DateTime structure of the current time. So, in code:
// in C#
DateTime now = DateTime.Now;
var now : System.DateTime;
now = System.DateTime.Now;
Took me a bit to remember how to do this…this next bit of code will basically create a variable of Type DateTime (available under the System namespace - not System.Collections) and then output the time to the console. You can do alot with this class and any objects instantiated from it, so you play around with the formatting til you get something you can use.
System.DateTime myTime = System.DateTime.Now;