Answer the question
In order to leave comments, you need to log in
Unity, c# and former key pressed?
Hello everyone, how to implement in Unity in c #, so that when you press the A key, for example, if the B key was pressed before, the values for example, the character’s speed are reset ? Keyword before? That is, these keys are like antagonists.
if (Input.GetKey(KeyCode.D))// нажата сейчас
{
if (Input.GetKey()// не знаю как написать была нажата до этого
{
{
speed=0;
}
Answer the question
In order to leave comments, you need to log in
Store in a variable whether the B key was pressed and when. When you press A - check if B has been pressed for a long time. When you press C - reset the variable responsible for the state of B.
Judging by a ton of questions, it’s too early for you to write games, start with something simpler, or go as a junior to the team - they will teach you.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question