What to do if "Key hold down"

Dear All

Sorry coming up with a question again. Did read some other posts about it, but could not identify a solultion.

How can I get a continues value if the key is hold down? In this case it the onMove method is just called by “KeyDown”…

        public void OnMove(InputAction.CallbackContext context)
        {
            var direction = context.ReadValue<Vector2>();

            if (direction == Vector2.zero)
                return;

            _turnController.GetActiveTank().Move(direction);           
        }

I know this isn’t probably what you were hoping to hear, but I couldn’t find a good way to get access to simple press/hold/reelase events, so I just gave up and wrapped the entire input system so that I could still use that convention.

The default interaction will send “Started” when a button is pressed, and “canceled” when a button is released. I simply hooked into those events to flag “pressed” and “held” bools that I created.

1 Like