So far i’ve been using a flag system that allows me to do something with my character whenever some key is up. The problem though is that i need something to handle small impulses AND long presses (like holding to shield)
By setting something to true it does work, but i also need to set it back to false. I’ve been doing this by setting the variable to false whenever the action is done. But sometimes the game is doing something else the action never really happens so the variable stays true.
for example:
if(Input.GetKeyUp("i")){
playerAttack = true;
}
i then set it back to false when a certain character attacks
but if then i read playerAttack do make a character attack but for some other reason she doesn’t the variable stays true. whats the best way to solve this?