I Have two functions, one is when I want my car to go forward, and the other to go backward, If I Want to switch between them, I Keep Pressing on the “D” key. this is my code `if(Input.GetKey(KeyCode.D)){
var direct = true;
}
if(Input.GetKey(KeyCode.R)){
var reverse = true;
}
if(direct){
goDirect();
}
else if(reverse)
{
goReverse();
};`
I Don’t want to keep holding the “D” or The “R” button to make the car go in whatever direction “Continue doing the same function as long as I’m holding the key”, I want to press once, I Pressed “D” so direct = true and the car continues to go forward unless I Press the “R” Button, It’s like ON/OFF Button ?