public void MoveRight(InputAction.CallbackContext context)
{
if (context.performed)
{
horizontal = 1;
buttonPressed = true;
}
else if (context.canceled)
{
buttonPressed = false;
}
}
I am using unity’s input system, and I have two inputs called MoveLeft and MoveRight. The horizontal variable does not change when I press the key, and I don’t know why. I am a beginner, and just started unity a week ago.
Definitely start with the official Unity3D tutorials for this. The answer will ALWAYS be much more than just some code, nothing that could easily be typed in this forum field tiny text box.
Two steps to tutorials and / or example code:
do them perfectly, to the letter (zero typos, including punctuation and capitalization)
stop and understand each step to understand what is going on.
If you go past anything that you don’t understand, then you’re just mimicking what you saw without actually learning, essentially wasting your own time. It’s only two steps. Don’t skip either step.