Search Unity

How to polling check the InputAction?

Discussion in 'Input System' started by watsonsong, Jun 26, 2018.

  1. watsonsong

    watsonsong

    Joined:
    May 13, 2015
    Posts:
    555
    I am checking the input state directly in the FixedUpdate, because some physic state like "grounding" or "touch wall" must be first check by physic ray-cast, and then check the input state to determine what to do.
    But now the InputAction is callback based, and the callback is not invoked each FixedUpdate. I don't know how an action is check the state, or I am using a incorrect way?
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Sorry for the long delay.

    Right now, this isn't super well defined in the API yet. There is some support for polling (all the lastXXX properties on actions) but it's not a good method. Actions process every single state change and looking at those properties only looks at the last thing that happened.

    There is some emerging stuff in the form of InputActionManager but it'll likely change quite significantly and ATM is a pain to use.

    What I would recommend for now is to just buffer up state from the various action callbacks and then process the state in FixedUpdate. That *should* work.