- Home /
Timer help please
Hey,
so i am trying to create a time that starts when i hold my firing button down and then counts down when i release the button.
im not looking for exact code im just looking for a place to start looking at?
according to my gues it has to do with Time.time and setting it equal to some variable
but i am probably wrong so i would appreciate some help thank you all for your time.
simply use "Invoke" which is the timer command in Uniuty3D
Answer by fafase · Aug 25, 2012 at 08:17 AM
ok so no code just pseudo code
if button is held down then start counter
temp counter += deltaTime
else if button is up then stop temp counter is assign to counter and back to 0
So you need Input.GetMouseButton that returns true as long as you press. Then Input.GetMouseButtonUp returns true when you release the button
other way is
if button is down then start counter
start counter= time
else if button is up then stop counter = time
total = stop counter - start counter;
this time you use GetMouseButtonDown and GetMouseButtonUp
Your answer
Follow this Question
Related Questions
how to find time of a button pressed 2 Answers
Simple LOD Manager Mesh to Mesh (Smoothly Fade) 0 Answers
Timer running down too quickly 1 Answer
[SOLVED] Java Converters In Unity? 2 Answers
How do I Reset Scene 1 Answer