- Home /
time synchronisation
how can i synchronize the time in the game with the real-time on the server
What server? The host of the game (Unity networking)? A bit more info could be helpful in this case.
Answer by AKAssassin · Apr 15, 2011 at 05:50 PM
You would use
Network.time
This will tell you the exact time the server says it is. You can use this along with info.timestamp from a networkviewserialize to determine the time it took for the data to arrive.
See link below for more details.
http://unity3d.com/support/documentation/ScriptReference/Network-time.html
Answer by Justin Warner · Apr 15, 2011 at 02:29 PM
function Update() { var dt : System.DateTime = System.DateTime.Now; var h : int = dt.Hour; var m : int = dt.Minute; var s : int = dt.Second;
print(dt); print(h + " " + m + " " + s); }
Always wondered this too =) Thanks.
http://forum.unity3d.com/threads/55738-How-to-get-current-System-time-in-unity-using-java-script