Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

Reading Last Key For Top Down Controller

Discussion in 'Input System' started by cecilcruxis, Oct 13, 2020.

  1. cecilcruxis

    cecilcruxis

    Joined:
    Sep 17, 2013
    Posts:
    116
    Hello, I was wondering if anyone knew the best way to grab the last key that was pressed or check to see if there is a change in state for certain actions.

    I am currently writing a top down character controller for 2D. I need to see what the last button that is clicked so I can set the direction that the player will be facing.

    Problem is at the moment let's say I am holding the up button and the right button a config for a dpad movement inside the input actions editor. Since I am holding both of them and getting values from both I don't know which was the last one I pressed sense both of them are sending data that they are both being held. So I could hit right and than up and it will show the right animation even though up was the last one hit.

    Is there any simple way to just see what was the last button pushed in an action is?
     
unityunity