|
Hi - I have a timer function set up which I programmed based on some posting here, but it is set up to run through the onGUI event, so the time is based on the amount of time the game has been running (I guess). But what I want it to do is not start the timer til the user clicks the logo to begin play. The way I have it set up now, if the user takes 10 seconds to click the start button, and the game timer is set to count down from 60 seconds, by the time they begin play there will only be 50 seconds left in the game. How do I change this to trigger after the click? Here's my code: TIMER SCRIPT: MENU SCRIPT:
(comments are locked)
|
|
I ended up doing this. I'm sure someone will inform me that this is the wrong way to do timers, but it worked for my purposes:
(comments are locked)
|
|
You need to set startTime when the touch is detected, not on start (by assigning it statically), so put startTime = 60 after, say , guiTexture.enabled = false; If I do that, the countdown (Time.time in onGUI) is still being based off of the total game time, and I also get an error in onGUI that startTime does not refer to anything because it hasn't been instantiated yet. What I need to figure out is how to make this not based on onGUI, right?
Jul 28 '11 at 05:18 PM
heaversm
(comments are locked)
|
