|
I'm making a clock and want it to show the system time of whatever computer the game is running on. Could anyone give me a pointer on how to do this?
(comments are locked)
|
|
Are you using C#? As long as you are using System you should have access to the DateTime libraries. I didn't see that in the included libraries. Unity does not include every namespace from the .Net framework. Have you checked that it is there?
Nov 14 '10 at 02:27 PM
Peter G
It's there in all versions of the .NET frameworks in unity. Also - you can use them in javascript too Adam, c# doesn't matter
Nov 14 '10 at 02:31 PM
Mike 3
I'm using javascript. Where would I find the DateTime libraries?
Nov 14 '10 at 06:17 PM
pauldstewart
Check the link for 'datetime libraries' in my answer.
Nov 15 '10 at 01:46 AM
Adam Rademacher
(comments are locked)
|
|
Here's a simple script I wrote in response to your question. This should get you started. This example will show the current system time in 12 hour (am/pm) format. This example is in JavaScript (UnityScript). Just attach this script to either the main camera, or some empty game object in scene. This will show the time both on the GUI, and will print to the console. Remember not to declare variables outside functions unless necessary. Also you don't need to compute AM/PM yourself, use string formatting instead. The script could be written like this:
Dec 17 '12 at 07:57 AM
Eric5h5
(comments are locked)
|
|
This was a piece of javescript that I was using to grab the date once a long time ago I modified it to do the time. This Link will give you all the different ways you can use System.DateTime in a string http://www.geekzilla.co.uk/View00FF7904-B510-468C-A2C8-F859AA20581F.htm
(comments are locked)
|
