Making a Timer Out out of 3D Text using C#.

Hey! The title practically says it all. But I should offer a bit of detail.

I am setting up a timer that is displayed in 3D text, and most of the tidbits I have obtained in regards to timers have limited to having the numbers displayed in GUI. So what alterations should I make in order for a timer script to work for 3D text?

  • Two digits are enough. I need 90 seconds on the clock.
  • the first 30 seconds will be dedicated to demonstrating the gameplay. Then the real game will run for the next 60 seconds until it’s over.
  • the timer should go off immediately when the scene runs.
  • Beyond the 3D text displaying the timer, there can be some other 3D texts displaying like booleans, like the word ‘START’ when the 30 seconds pass and ‘stop’ when the last 60 seconds are up.

Thank you all for your patience and your passion with the software!

This reads like a recipe for someone to write a script for you. Here is a basic setup you can extend with your other features.

  • Do: Game Object > Create Other > 3D Text
  • Size and position the text in the window
  • Add the following script to the game object (labeled ‘New Text’ in the Hierarchy window):

#pragma strict

var time = 90.0;
private var tm : TextMesh;

function Start () {
	tm = GetComponent(TextMesh);
}

function Update () {
	time -= Time.deltaTime;
	tm.text = Mathf.RoundToInt(time).ToString();
}