Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Why no ReadValueAsButton on InputAction?

Discussion in 'Input System' started by CDF, Jun 18, 2020.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,324
    it seems only CallbackContext has a method ReadValueAsButton, and takes the State from the InputAction to determine the button value.

    maybe there's a technical reason why. But sure would be nice to have that method on InputAction, so I can call it when polling the action
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    An improved polling API for InputAction is in the works. We hope to have it in 1.1. There are indeed some technical problems to deal with but we're working on having IsPressed (that'd be the equivalent of ReadValueAsButton), WasPressedThisFrame, and WasReleasedThisFrame on InputAction. The current polling API indeed leaves things to be desired there.
     
    CDF likes this.
  3. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,324
    That would be awesome, thanks