Search Unity

[Input System 1.0.1] How to get continuous input updates (when using SetCallbacks)

Discussion in 'Input System' started by niuage, Dec 11, 2020.

  1. niuage

    niuage

    Joined:
    Nov 17, 2019
    Posts:
    123
    Hi,

    Sorry, I know people asked something similar, but I'm lost with the different versions.

    Code (CSharp):
    1.  
    2. public class SimpleCameraController : MonoBehaviour, IEditorModeActions
    3. {
    4.     public PlayerActions actions;
    5.  
    6.  
    7.    
    8.     private void Awake()
    9.     {
    10.          actions = new PlayerActions();
    11.          actions.EditorMode.SetCallbacks(this);
    12.     }
    13.  
    14.     public OnMove(InputAction.CallbackContext context)
    15.     {
    16.         # only called on press, once, and on button release.
    17.  
    18.         # here, I want logic to move a character, hence why it has to be called every frame.
    19.     }
    20.  
    21.     # more callbacks...
    22. }
    23.  
    My question is simple: using this method of reacting to events, can I receive callbacks every frame?

    I know that an option of handling this case would be to just have some code in Update, and use something like

    Code (CSharp):
    1. actions.EditorMode.Move.ReadValue<Vector2>() # etc
    but i was hoping to use the interface implementation.

    Thank you!