Search Unity

Migrating from InControl

Discussion in 'Input System' started by bdovaz, Jun 27, 2019.

  1. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,051
    @Rene-Damm I'm evaluating on migrating to the new Input System but first I want to understand how this transition will be.

    I don't know if you know InControl asset. This asset has the following:

    http://www.gallantgames.com/pages/incontrol-getting-started

    http://www.gallantgames.com/pages/incontrol-standardized-controls

    Code (CSharp):
    1.  
    2. InputControl axisInputControl = InputManager.ActiveDevice.LeftStickY;
    3.  
    4. float value = axisInputControl.value;
    5.  
    6. InputControl buttonInputControl = InputManager.ActiveDevice.Action1;
    7.  
    8. bool pressed = buttonInputControl.isPressed;
    9.  
    The equivalent will be:

    https://github.com/Unity-Technologi...m.unity.inputsystem/Documentation~/Actions.md

    Code (CSharp):
    1.  
    2. InputAction axisInputAction = null;
    3.  
    4. axisInputAction.performed += context => {
    5.     float value = context.ReadValue<float>();
    6. };
    7.  
    8. InputAction buttonInputAction = null;
    9.  
    10. buttonInputAction.performed += context => {
    11.     bool pressed = context.ReadValue<bool>();
    12. };
    13.  
    I'm I correct?

    Thanks.