No key press or down????

Hi,
Most of the game engines I have use have a way you can have some thing happen when their no key is press or down? Some thing like this if no key is press or down then set speed to 0. I don’t know if unity have anything like that. I looked in the “script” manual and could not find anything that would do that.
All so is their some type of script that will increase a var or decrease var with some type of action
Like w key is down so inc speed by 0.01 every sec or min or what ever.
Thank you
renny

I think Input.GetKey(KeyCode.Space); or Input.GetButton(“Fire1”); are what you’re looking for. They will return a true if it’s down and a false if it’s up. The second one allows the user to customize which key is used for firing a weapon.

Are you saying you want to know when no keys are held/hit?

If so you’d want to take any possible input keys (like let’s say w, a, s, and d) and check for when they aren’t down or pressed. So lots of “if (!Input.GetKeyDown (Keycode.W) && !Input.GetKey (Keycode.W) …” for every possible key.

Simply take advantage of your execution order. Either execute the null statement first, and then override it with any input that occurs. Or put it as the last block of an if-else if-else block. That way it only gets dealt with if no other input occurs.

1 Like

Thank you all, I have a lot to think about now.
One more thing, I see their is a new update for unity5,but it want to install it as I download it.
I have very slow internet, takes 10 hours to download. I want to go to the coffee shop where they have DSL to down load it.
I can’t take my desk top there. Is their a download with a installer or set up?
Thank you
renny

I forget how fast DSL is when I don’t use it much. I downloaded the new update at the coffee shop today.
Less than 20 min, at home it takes 8 to 10 hours. Well I have the new unity on the computer now. I also install a chat room on my free web site. So if anyone want to talk in real time let me know.
Thank you all for your help
renny