docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class SpatialPointerDevice

    An Input System device that exposes one primary spatial pointer and an array of additional spatial pointers, providing state suitable for spatial interactions (e.g., ray-based or direct interactions).

    Inheritance
    object
    InputControl
    InputDevice
    SpatialPointerDevice
    Inherited Members
    InputDevice.InvalidDeviceId
    InputDevice.ReadValueFromBufferAsObject(void*, int)
    InputDevice.ReadValueFromStateAsObject(void*)
    InputDevice.ReadValueFromStateIntoBuffer(void*, void*, int)
    InputDevice.CompareValue(void*, void*)
    InputDevice.MakeCurrent()
    InputDevice.OnAdded()
    InputDevice.OnRemoved()
    InputDevice.OnConfigurationChanged()
    InputDevice.ExecuteCommand<TCommand>(ref TCommand)
    InputDevice.ExecuteCommand(InputDeviceCommand*)
    InputDevice.description
    InputDevice.enabled
    InputDevice.canRunInBackground
    InputDevice.added
    InputDevice.remote
    InputDevice.native
    InputDevice.updateBeforeRender
    InputDevice.deviceId
    InputDevice.lastUpdateTime
    InputDevice.wasUpdatedThisFrame
    InputDevice.allControls
    InputDevice.valueType
    InputDevice.valueSizeInBytes
    InputDevice.all
    InputControl.m_StateBlock
    InputControl.ToString()
    InputControl.EvaluateMagnitude()
    InputControl.EvaluateMagnitude(void*)
    InputControl.WriteValueFromBufferIntoState(void*, int, void*)
    InputControl.WriteValueFromObjectIntoState(object, void*)
    InputControl.TryGetChildControl(string)
    InputControl.TryGetChildControl<TControl>(string)
    InputControl.GetChildControl(string)
    InputControl.GetChildControl<TControl>(string)
    InputControl.RefreshConfigurationIfNeeded()
    InputControl.RefreshConfiguration()
    InputControl.CalculateOptimizedControlDataType()
    InputControl.ApplyParameterChanges()
    InputControl.name
    InputControl.displayName
    InputControl.shortDisplayName
    InputControl.path
    InputControl.layout
    InputControl.variants
    InputControl.device
    InputControl.parent
    InputControl.children
    InputControl.usages
    InputControl.aliases
    InputControl.stateBlock
    InputControl.noisy
    InputControl.synthetic
    InputControl.this[string]
    InputControl.magnitude
    InputControl.currentStatePtr
    InputControl.previousFrameStatePtr
    InputControl.defaultStatePtr
    InputControl.noiseMaskPtr
    InputControl.stateOffsetRelativeToDeviceRoot
    InputControl.optimizedControlDataType
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    Namespace: Unity.PolySpatial.InputDevices
    Assembly: Unity.PolySpatial.Core.dll
    Syntax
    [InputControlLayout(stateType = typeof(SpatialPointerDeviceState))]
    public class SpatialPointerDevice : InputDevice
    Remarks

    The device publishes a primary spatial pointer and up to MaxSpatialPointers additional pointer controls. It assigns a contiguous range of interaction IDs (touch IDs) for its pointers so that other systems can correlate events per device.

    Properties

    inputs

    The collection of spatial pointer controls exposed by this device.

    Declaration
    public ReadOnlyArray<SpatialPointerControl> inputs { get; protected set; }
    Property Value
    Type Description
    ReadOnlyArray<SpatialPointerControl>
    Remarks

    The array length matches MaxSpatialPointers. Each control maps to a distinct spatial pointer and is associated with a stable interaction ID within the device's assigned range.

    primaryInput

    The primary spatial pointer control exposed by this device.

    Declaration
    public SpatialPointerControl primaryInput { get; protected set; }
    Property Value
    Type Description
    SpatialPointerControl
    Remarks

    This control mirrors the most relevant or active spatial pointer state at any given time and is used by systems that expect a single primary pointer. Its state is updated on incoming events and may reflect the most recent active pointer if multiple are present.

    Methods

    FinishSetup()

    Completes control discovery and initializes device-specific state.

    Declaration
    protected override void FinishSetup()
    Overrides
    InputControl.FinishSetup()
    Remarks

    Resolves the primaryInput and populates inputs with the remaining spatial pointer controls. Also assigns a contiguous range of interaction IDs (touch IDs) to this device so each pointer can be uniquely identified across devices.

    GetStateOffsetForEvent(InputControl, InputEventPtr, ref uint)

    Computes the byte offset into the device state for a given control and input event.

    Declaration
    public bool GetStateOffsetForEvent(InputControl control, InputEventPtr eventPtr, ref uint offset)
    Parameters
    Type Name Description
    InputControl control

    The control whose state offset is requested. If null, an offset corresponding to the pointer in the event is selected to facilitate InputUser iteration.

    InputEventPtr eventPtr

    The input event for which to calculate the offset. Only state events with the SpatialPointerState format are supported.

    uint offset

    On success, receives the byte offset from the start of the device state to the target pointer state.

    Returns
    Type Description
    bool

    True if an appropriate offset could be determined; otherwise, false.

    Remarks

    This mirrors the selection logic used by TouchScreen devices, allowing InputUser to iterate spatial pointer states in a predictable manner. When control is null, the method chooses the matching or next active pointer slot based on the event's interaction ID and phase.

    OnNextUpdate()

    Performs per-frame maintenance on pointer state before the next input update.

    Declaration
    public void OnNextUpdate()
    Remarks

    Resets the deltaInteractionPosition for all spatial pointers (including the primary pointer), ensuring that deltas only represent changes within the current frame/update.

    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)