docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Add processors to controls

    You can have any number of Processors directly on an InputControl, which then process the values read from the Control. Whenever you call ReadValue on a Control, all Processors on that Control process the value before it gets returned to you. You can use ReadUnprocessedValue on a Control to bypass the Processors.

    The Input System adds Processors to a Control during device creation, if they're specified in the Control's layout. You can't add Processors to existing Controls after they've been created, so you can only add Processors to Controls when you're creating custom devices. The devices that the Input System supports out of the box already have some useful Processors added on their Controls. For instance, sticks on gamepads have a Stick Deadzone Processor.

    If you're using a layout generated by the Input System from a state struct using InputControlAttributes, you can specify the Processors you want to use with the processors property of the attribute, like this:

    public struct MyDeviceState : IInputStateTypeInfo
    {
        public FourCC format => return new FourCC('M', 'Y', 'D', 'V');
    
        // Add an axis deadzone to the Control to ignore values
        // smaller then 0.2, as our Control does not have a stable
        // resting position.
        [InputControl(layout = "Axis", processors = "AxisDeadzone(min=0.2)")]
        public short axis;
    }
    

    If you create a layout from JSON, you can specify Processors on your Controls like this:

    {
        "name" : "MyDevice",
        "extend" : "Gamepad", // Or some other thing
        "controls" : [
            {
                "name" : "axis",
                "layout" : "Axis",
                "offset" : 4,
                "format" : "FLT",
                "processors" : "AxisDeadzone(min=0.2)"
            }
        ]
    }
    
    In This Article
    Back to top
    Copyright © 2026 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)