already checked the scripting forum, reference, and answers, did’t find anything like what i need.
i’m playing a sneaky tricky to avoid using animated textures for a digital watch on a character’s arm.
the character’s hand animates so it is drawn right up to the camera, and i need to have it pop up a little gui digital watch face at that point. a kind of hitchcock swipe
but, how would i go about formatting the characters, or even displaying them for that matter?
If you’re just asking how to properly format the time, this would probably be the simplest approach:
var watchPosition = Rect(10,10,200,50);
var initialHour = 12;
var initialMinute = 0;
var initialSecond = 0;
private var dateTime : System.DateTime;
function Awake(){
dateTime = new System.DateTime(1, 1, 1, initialHour, initialMinute, initialSecond);
}
function Update(){
dateTime = dateTime.AddSeconds(Time.deltaTime);
}
function OnGUI(){
GUI.Label(watchPosition, String.Format("{0:hh:mm:ss}", dateTime));
}
You should also create a custom GUI style with a proper ‘digital’ font.
oh, wow, thanks tonyd!
i’ll have to dissect your code a bit since i need the watch to be running at 72 times normal speed in order to keep pace with the rest of the game’s machanics but mostly i was trying to get a way to format and display the time