how to keep input for several seconds without holding the key.

I am making a car game.
For boost the car I use ‘input.getkey’ method.
When I press the key it works. But I have to hold the key to continue boosting.
I want to keep that boosting for 5 seconds in single press.
Please Help me.

I’m learning C#, i’ll try to answer you but it would be great if we have more insight from experienced programmers. Ah, and helps a lot if you show us your code so we have a better scenario.

I think what you really need is how to make a timer.

private float BoostTimer;
private float BoostLength = 5;

if (BoostTimer < BoostLength)
     // insert here your boosting code
else if (BoostTimer > BoostLength)
     // insert here not boosted speed code

BoostTimer += Time.fixedDeltaTime; // this will add time value as its counting
BoostTimer = 0; // You have to reset it somewhere

I think I can assist better if you show your code.