docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class InputProcessor

    A processor that conditions/transforms input values.

    Inheritance
    object
    InputProcessor
    InputProcessor<TValue>
    Namespace: UnityEngine.InputSystem
    Assembly: Unity.InputSystem.dll
    Syntax
    public abstract class InputProcessor
    Remarks

    To define a custom processor, it is usable best to derive from InputProcessor<TValue> instead of from this class. Doing so will avoid having to deal with things such as the raw memory buffers of Process(void*, int, InputControl).

    Note, however, that if you do want to define a processor that can process more than one type of value, you can derive directly from this class.

    Properties

    cachingPolicy

    Caching policy of the processor. Override this property to provide a different value.

    Declaration
    public virtual InputProcessor.CachingPolicy cachingPolicy { get; }
    Property Value
    Type Description
    InputProcessor.CachingPolicy
    See Also
    processors
    processors
    RegisterProcessor<T>(string)
    GetParameterValue(InputAction, string, InputBinding)
    ApplyParameterOverride(InputActionMap, string, PrimitiveValue, InputBinding)

    Methods

    Process(void*, int, InputControl)

    Process an input value stored in the given memory buffer.

    Declaration
    public abstract void Process(void* buffer, int bufferSize, InputControl control)
    Parameters
    Type Name Description
    void* buffer

    Memory buffer containing the input value. Must be at least large enough to hold one full value as indicated by bufferSize.

    int bufferSize

    Size (in bytes) of the value inside buffer.

    InputControl control

    Optional control that the value originated from. Must have the same value type that the processor has.

    Remarks

    This method allows processing values of arbitrary size without allocating memory on the GC heap.

    See Also
    processors
    processors
    RegisterProcessor<T>(string)
    GetParameterValue(InputAction, string, InputBinding)
    ApplyParameterOverride(InputActionMap, string, PrimitiveValue, InputBinding)

    ProcessAsObject(object, InputControl)

    Process an input value, given as an object, and return the processed value as an object.

    Declaration
    public abstract object ProcessAsObject(object value, InputControl control)
    Parameters
    Type Name Description
    object value

    A value matching the processor's value type.

    InputControl control

    Optional control that the value originated from. Must have the same value type that the processor has.

    Returns
    Type Description
    object

    A processed value based on value.

    Remarks

    This method allocates GC heap memory. To process values without allocating GC memory, it is necessary to either know the value type of a processor at compile time and call Process(TValue, InputControl) directly or to use Process(void*, int, InputControl) instead and process values in raw memory buffers.

    See Also
    processors
    processors
    RegisterProcessor<T>(string)
    GetParameterValue(InputAction, string, InputBinding)
    ApplyParameterOverride(InputActionMap, string, PrimitiveValue, InputBinding)

    See Also

    processors
    processors
    RegisterProcessor<T>(string)
    GetParameterValue(InputAction, string, InputBinding)
    ApplyParameterOverride(InputActionMap, string, PrimitiveValue, InputBinding)
    In This Article
    Back to top
    Copyright © 2024 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)