Question by
Rembo4Fight · May 06, 2018 at 05:06 AM ·
scripting probleminputtimerenablegetkeydown
How to enable input when it is pressed?
Hello, I'm making the system where is when the player is pressing R button it starts the process and I need to make it sure that the player is not holding it for too long.
Is there any way or command to make it easy and right?
Comment
Answer by tormentoarmagedoom · May 06, 2018 at 09:32 PM
I need to disable this input Like(input.getkeydown == keycode.R) how can i achieve this?
then just create a timer, and use a a if sentence to check if the time passed from started pressing the key is not too high. and a if with Input.Get$$anonymous$$eyUp() to reset the timer something like this.
float timer = 0;
if (Input....)
{
if (timer<2)
{
Do things;
timer+=time.deltatime;
}
}
if (Input.Get$$anonymous$$EyUp....)
{
timer=0;
}