Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Custom Processors don't get called if value is 0

Discussion in 'Input System' started by IroxGames, Jan 25, 2022.

  1. IroxGames

    IroxGames

    Joined:
    Feb 8, 2020
    Posts:
    16
    Having a custom processor which f.e. adds a number onto the value doesn't get called if the value is 0

    Code (CSharp):
    1. #if UNITY_EDITOR
    2.     [InitializeOnLoad]
    3. #endif
    4.     public class AddValueProcessor : InputProcessor<float>
    5.     {
    6. #if UNITY_EDITOR
    7.         static AddValueProcessor()
    8.         {
    9.             Register();
    10.         }
    11. #endif
    12.         public override float Process(float value, InputControl control)
    13.         {
    14.             return value + 0.5f;
    15.         }
    16.        
    17.         [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
    18.         static void Register()
    19.         {
    20.             InputSystem.RegisterProcessor<AddValueProcessor>();
    21.         }
    22.     }
    Adding this processor and logging the value with ReadValue<float>() on an axis returns "0" if no input is given.

    Is this intended behavior?
     
  2. andrew_oc

    andrew_oc

    Unity Technologies

    Joined:
    Apr 16, 2021
    Posts:
    77
  3. IroxGames

    IroxGames

    Joined:
    Feb 8, 2020
    Posts:
    16
    Thanks for the quick reply! The issue tracker says it's "fixed in 1.3.0" we are working on 1.3.0 and the issue still exists :D
     
  4. andrew_oc

    andrew_oc

    Unity Technologies

    Joined:
    Apr 16, 2021
    Posts:
    77
    Ah, sorry about that. This one didn't actually make it into 1.3.0 because we decided to do it in the more correct way. It should be in the next release.