I cannot for the life of me firgue out what you are trying to do. Some disambiguation in your question would be a huge help, from looking at your code (which I had to format myself because you can't be bothered) I've no clue what effect your trying to achieve. What is all this about tap and timer? It appears like when you press a button you want the timer to reset to 0 but you also have it that the timer keeps adding time.deltatime to itself? Do you get an error when compiling this code? Errors during runtime? Basically what I'm saying is your question is too vague to give a definitive answer.I can tell you for sure that if your trying to move a player this is definatly the wrong way to go about it.
The problem with your question is you have specified that you want it to move at a fixed speed and a fixed amount but not the time scale that you want it to be in, eg, Speed = distance/ time. distance = speed * time, time = distance/speed. So you want it do you want it to move 5 units at 5 units/second?or 5 units at 1 unit/second? etc
Anyway less about basic physics and how poor your question is and back to an definitive answer. if you are using a character controller and what it to move when you hold down an arrow key and stop moving when you let go use something with this effect
var speed : float = 1;
moveDirection = Vector3(Input.GetAxis("Horizontal"),Input.GetAxis("Vertical"),0);
moveDirection = transform.TransformDirection(moveDirection*speed);
if you want your character to move a fixed amount then stop no matter how long you hold down the button then use something to this effect
var DistanceAmount : float = 1;
var KeyHasBeenPressed : boolean = false;
if (Input.GetKeyDown(KeyCode.RightArrow))
{
if (KeyHasBeenPressed == false)
{
transform.position += DistanceAmount;
KeyHasBeenPressed = true:
}
}
if (Input.GetKeyUp(KeyCode.RightArrow))
{
KeyHasBeenPressed = false;
}
what keith has said will move your object to the right non-stop at said velocity (5 units/second) You can incorporate that into a key press to get some effect that you may or may not want, depending on what you actually want because you havn't specified properly.
in the FAQ for this site which you havn't read (or havn't understood) it clearly states
What kind of questions can I ask here?
Unity questions, of course! As long as
your question is:
detailed and specific
written clearly and simply
of interest to at least one other Unity user somewhere
... it is welcome here. No question is
too trivial or too "newbie". Oh yes,
and it should be about Unity.
Please look around to see if your
question has already been asked (and
maybe even answered!) before you ask.
This website is already has too many narrow-minded and self-absorbed idiots who's questions don't get answerewd so they post duplicates until someone writes them a piece of code that works how they want. Learn to code properly and don't come here everytime you cant figure out the answer look other places, google it, scroll through the archives of related questions here (its what the site is primarily for!!!) use the script reference site provided by unity, use a tutorial that will walk you through it step by step. Like Unity says there is no such question that is too "newbie" but there is a load of stupid questions here that could have been answered had the person gone to look for the answer themselves instead of crying like b|<% and posting question after question here. Go learn independantly and when you get stuck then you post a question here, or if you need to figure out a way to do something and you don't just want someone to hold your hand and write your code.
Use code tags to show code. In your edit window highlight your code and click the "" icon at the top, it'll wrap it up for you and keep the formatting.
– anon45606706Whoops, correction, it's the binary icon. Not the quotes.
– anon45606706