So I’m new to Unity and C# so maybe I’m doing something wrong but I don’t know. I followed and online tutorial and for my input manager my update method looks like this:
// Update is called once per frame void Update () { if (gm.State == GameState.Playing) { if (Input.GetKey("right")) { gm.Move(MoveDirection.Right); } else if (Input.GetKey("left")) { gm.Move(MoveDirection.Left); } else if (Input.GetKey("up")) { gm.Move(MoveDirection.Up); } else if (Input.GetKey("down")) { gm.Move(MoveDirection.Down); } } }
The problem is when I play the game and press any of those keys just once it returns like I pressed it multiple times even though I press it once and I am not holding it. gm is a reference to my game manager script that controls the moves. I can’t find anything on how to fix this but in the console it shows the three or four presses from my debug statements. Any help would be appreciated, thank you in advance.