Key Press resetting when leaving a trigger.

Hey,

So I’m working on a game where the player can enter and exit triggers and pressing spacebar while in the triggers runs a function. I need it to be on Input.GetKey instead of GetKeyDown because it ticks over something for the duration of holding spacebar down.

The problem I’m having is a player can press down in one trigger, keep the button pressed and walk over to another trigger and it’ll carry on. I need a way of resetting the button press when the player leaves the first trigger so that they have to repress to start in the next trigger.

Is there a function that resets the press, even if the button is still being held down? So the game think the button has been released and then requires the press again?

To be clear, I know how to call on leaving a trigger etc, I just need the method for resetting the button press without actually letting go.

Thanks in advance! :slight_smile:

You can’t tell the computer you have released the button unless you release the button. To solve this problem, you will probably have to have a flag, It’s hard to say where and how to implement this without seeing you’re code.