|
This is what i have setup so far, 3dtext with a box collider that says begin and another that says finish. i would like to count the time it too the user to go from begin to end accurately since Time.time starts as soon as the game begins, i would like to reset it to Zero when the player touches begin, and stop/ print the amount of time it took when they reached finish. or create another system that can track the time from "begin" to "finish" explained in another way: create a stop watch timer
(comments are locked)
|
|
When the player touches begin do this:
to find out how long the actual game/round is running do this:
Done. ok for my "begin", i wrote: float startTime = Time.time; function OnTriggerEnter (other : Collider) { guiText.text = ""+startTime; Destroy(gameObject); } for the "finish" i wrote: float curTime = Time.time - startTime; function OnTriggerEnter (other : Collider) { guiText.text = ""+curTime; Destroy(gameObject); } but it seems there is an error in the finish script and i dont know how to deal with it
Jul 17 '10 at 06:19 AM
user-3653 (google)
What happens? Are you destroying the gameObject that contains your guiText? I need to see your code to help you there.
Jul 17 '10 at 10:30 AM
StephanK
it tells me a semi colon has to be inserted after the word "float", here is the error......... Timer Begin.js(1,6): UCE0001: ';' expected. Insert a semicolon at the end.......here is line 1......float startTime = Time.time;
Jul 17 '10 at 11:31 PM
user-3653 (google)
in javascript the syntac is different. the line should read var startTime : float;
Jul 18 '10 at 12:45 AM
StephanK
WONDERFUL! thank you kind sir
Jul 18 '10 at 02:03 AM
user-3653 (google)
(comments are locked)
|
