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

How to Edit an input action processor

Discussion in 'Input System' started by Proportion1, Mar 26, 2022.

  1. Proportion1


    Jan 6, 2013
    Hi i would like to change the sensitivity of my Look action. So i added a Scale Vector 2 processor to it.


    I can see the inputAction.processors property to read it, but im not sure how you would go about editing the x and y value of the processor.

    Code (CSharp):
    1. public InputActionAsset inputActionAsset;
    2.     public InputAction Look;
    4.     void Start()
    5.     {
    6.         inputActionAsset = GameObject.FindGameObjectWithTag("EventSystem").GetComponent<InputSystemUIInputModule>().actionsAsset;
    7.         Look = inputActionAsset.FindActionMap("Player").FindAction("Look");
    8.         Debug.Log(Look.processors);// returns ScaleVector2
    9.     }
    11.     // this is attached to a UI slider
    12.     public void LookSensitivity(float sensitivity)
    13.     {
    14.         //this code doesn't work, just showing what i'd like it to do.
    15.         //Look.processors.ScaleVector2.x = sensitivity
    16.         //Look.processors.ScaleVector2.y = sensitivity
    17.     }
    I do understand i could just add a look multiplier to my player at runtime, i was just curious if there is a way to edit processors directly.

    Attached Files:

  2. Rene-Damm


    Sep 15, 2012
    ATM this requires setting an override on the binding.

    Code (CSharp):
    1. action.ApplyBindingOverride(new InputBinding {
    2.     overrideProcessors = "scaleVector2(x=1.2, y=1.3)"
    3. });
    In 1.4, there is a new API where this can be achieved directly.

    Code (CSharp):
    1. action.ApplyParameterOverride("scaleVector2:x", 1.2f);
    3. // Or.
    4. action.ApplyParameterOverride((ScaleVector2Processor p) => p.x, 1.2f);
    Last edited: Mar 31, 2022
    Richay and (deleted member) like this.
  3. JeffreyBennett


    May 18, 2017
    input_action_reference.png I'm missing a connection here, and I cannot seem to see it. If anyone sees the mistake I'm making please let me know.

    What is the thing that ties an input action reference to the input action itself? How is that connection built?

    I'm in Unity 2021.3.8f1 with Input System 1.4.2, player input module > UI_EventSystem, behavior: Send Messages

    For example, if I want to change the look inversion processor on a binding (It goes like this: Input Action Asset > Action Map > Action > Binding > Processor > Parameter (i.e setting) on the processor).

    Here is my code:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.EventSystems;
    3. using UnityEngine.InputSystem;
    5. public class myScript : MonoBehaviour
    6. {
    8.     public InputActionAsset inputActionAsset; //In the Editor Property panel, drag / drop the new input system's action map from the project assets to this slot
    9.     public InputAction inputActionLook;
    10.     public InputActionReference lookAction;
    12. void Start()
    13. {
    15. //Something somewhere, about here, should somehow say "lookAction refers to inputActionLook," but I don't know what does that. Do I drag something into the lookAction variable in the editor? Do I write code to do this? How is this link established?
    17. lookAction.action.ApplyBindingOverride(new InputBinding {overrideProcessors = "invertVector2(invertX=false,invertY=false)" });
    18. }
    20. }
    I've looked all over the documentation. I would think I'd find that information here >

    Does anyone see what I'm missing about how to connect the input action reference to the input action itself?
    Last edited: Sep 5, 2022
  4. CausticLasagne


    Oct 2, 2015
    Hi. I know this was asked a while ago but I've tried the above code and also Rene-Damm's code. I can't seem to get it to work. I've managed to get the debug log to print out the values of the stick deadzone processor I have but I can't change them to new values. I've unticked default values in the input settings just in case.

    Code (CSharp):
    1. Debug.LogError("Processor Pre-Edit" + PlayerInputInst.actions["Look Camera"].processors);
    2. PlayerInputInst.actions["Look Camera"].ApplyParameterOverride("StickDeadzone:x", value.x);
    3. PlayerInputInst.actions["Look Camera"].ApplyParameterOverride("StickDeadzone:y", value.y);
    4. Debug.LogError("Processor Post-Edit" + PlayerInputInst.actions["Look Camera"].processors);
    I also tried the other type using StickDeadzoneProcessor but that didn't work either.
    Am I not doing something right?
    AndreIvankio likes this.
  5. Dawdlebird


    Apr 22, 2013
    To modify stick deadzone via script, it should look like this:
    Code (CSharp):
    1. action.ApplyParameterOverride("StickDeadzone:min", 0.3f);
    2. action.ApplyParameterOverride("StickDeadzone:max", 0.9f);
    x and y are for a scaleVector. And those 0.3f and 0.9f values should of course be variables.
    Alternatively, this can be written as:
    Code (CSharp):
    1. using UnityEngine.InputSystem.Processors; // <- without this you won't have the preprocessor classes available
    3. action.ApplyParameterOverride((StickDeadzoneProcessor s) => s.min, 0.3f);
    4. action.ApplyParameterOverride((StickDeadzoneProcessor s) => s.max, 0.9f);
    Last edited: Jul 18, 2023
  6. valentin56610


    Jan 22, 2019
    Are we really gonna pretend that using strings to get and apply 'static' stuff like processors was a good idea?
    Why is there no action.GetProcessor() or action.AddProcessor() and a Processor object we can interact with?
    This is some really poor thinking
    jjmcc2660 and VeryVeryKnopp like this.
  7. MrKodei


    Aug 8, 2021

    this is really not working for me. Are there any restrictions i am missing?
    Also, i am using the Cinemachine Input Provider on a CinemachineFreeLook camera.
    Last edited: May 8, 2024