Calling coroutine with Input.GetAxis problems

I’m trying to figure out how to call a coroutine every nth second by using Input.GetAxis. However, I’ve run into a problem. While pressing the key assigned to the axis, it calls the coroutine, however, being that the controls are in Update(), the coroutine gets called multiple times per second. I know that I can use Input.GetKeyDown for this, however I want the player to be able to pick their controls. Is what I want to do possible?

You can use

The Input.GetButton functions can be set by the user or by you.

You can do it in Edit → Project Settings → Input

You can find more info here:

Try to find out when the value returned by GetAxis changed, it will be the moment the user started or ended the input.

If it’s a start, you can either reset a timer and call a coroutine each time this timer reaches X, or start a coroutine that start sub-coroutines every X seconds. Don’t forget to stop the previous instance of it.

I hope I understood what you meant.