|
How to make a timer in the game? What I have so far? I have a main menu, when you click start game it goes to another scene and you are in a maze. What I need? What I need is once it enters the other scene to have a timer on the bottom of the screen to see how long it takes to finish. Any ideas? Thanks, Chris
(comments are locked)
|
|
This should get you started:
In your OnTriggerEnter function you then have to write the following to access the time when the trigger was entered (adjust "Main Camera" and "Timer" to whatever your game object and script name are that contain your timer): Ahh, Askhan beat me to it, but I suppose I leave it up for the formatting and stuff.
Feb 13 '10 at 08:42 PM
Sebas
Thanks, this worked great!
Feb 14 '10 at 05:31 AM
cmos
Hey Again..... is there any way to retrive the value of the Label from another script I am running. Basically, I want to know the time when i step on a block.
Feb 15 '10 at 12:56 AM
cmos
I edited the answer to answer your additional question. You add a member variable in your timer script so you can access it from other scripts. You access this variable by finding the game object and script which contains this variable. You do this in your OnTriggerEnter function. More information on this topic can be found in the script reference (http://unity3d.com/support/documentation/ScriptReference/index.Member_Variables_26_Global_Variables.html) or the chapter on game objects and components under the same link
Feb 15 '10 at 02:07 AM
Sebas
I realise this is quite old, but the line with String.Format is assigning to 'text', a variable that doesn't exist.
Sep 26 '10 at 09:08 AM
Marowi
(comments are locked)
|
|
Plz how to make this timer reversed ? For example from 30.00 to 0... Thanks.
(comments are locked)
|
|
you should get the time.time in a awake or start function in new scene and then subtract the current time.time from the first value. somethings like this
(comments are locked)
|
|
can i noe where to place all these method at in unity?
(comments are locked)
|
