Class VisionOSSpatialPointerDevice
Implements
Inherited Members
Namespace: UnityEngine.XR.VisionOS.InputDevices
Assembly: Unity.XR.VisionOS.dll
Syntax
public class VisionOSSpatialPointerDevice : InputDevice, IInputStateCallbackReceiver
Properties
inputs
Declaration
public ReadOnlyArray<VisionOSSpatialPointerControl> inputs { get; protected set; }
Property Value
Type | Description |
---|---|
ReadOnlyArray<VisionOSSpatialPointerControl> |
primaryInput
Declaration
public VisionOSSpatialPointerControl primaryInput { get; protected set; }
Property Value
Type | Description |
---|---|
VisionOSSpatialPointerControl |
Methods
FinishSetup()
Perform final initialization tasks after the control hierarchy has been put into place.
Declaration
protected override void FinishSetup()
Overrides
Remarks
This method can be overridden to perform control- or device-specific setup work. The most common use case is for looking up child controls and storing them in local getters.
public class MyDevice : InputDevice
{
public ButtonControl button { get; private set; }
public AxisControl axis { get; private set; }
protected override void OnFinishSetup()
{
// Cache controls in getters.
button = GetChildControl("button");
axis = GetChildControl("axis");
}
}</code></pre></example>
GetStateOffsetForEvent(InputControl, InputEventPtr, ref uint)
Compute an offset that correlates control
with the state in eventPtr
.
Declaration
public bool GetStateOffsetForEvent(InputControl control, InputEventPtr eventPtr, ref uint offset)
Parameters
Type | Name | Description |
---|---|---|
InputControl | control | Control the state of which we want to access within |
InputEventPtr | eventPtr | An input event. Must be a UnityEngine.InputSystem.LowLevel.StateEvent or UnityEngine.InputSystem.LowLevel.DeltaStateEvent |
uint | offset |
Returns
Type | Description |
---|---|
bool | False if the correlation failed or true if |
Remarks
This method will only be called if the given state event has a state format different than that of the device. In that case, the memory of the input state captured in the given state event cannot be trivially correlated with the control.
The input system calls the method to know which offset (if any) in the device's state block to consider the state
in eventPtr
relative to when accessing the state for control
as found in
the event.
An example of when this is called is for touch events. These are normally sent in UnityEngine.InputSystem.LowLevel.TouchState format
which, however, is not the state format of UnityEngine.InputSystem.Touchscreen (which uses a composite of several TouchStates).
When trying to access the state in eventPtr
to, for example, read out the touch position,
See Also
OnNextUpdate()
A new input update begins. This means that the current state of the device is being carried over into the next frame.
Declaration
public void OnNextUpdate()
Remarks
This is called without the front and back buffer for the device having been flipped. You can use UnityEngine.InputSystem.LowLevel.InputState.Change(UnityEngine.InputSystem.InputDevice, UnityEngine.InputSystem.LowLevel.InputEventPtr, UnityEngine.InputSystem.LowLevel.InputUpdateType) to write values into the device's state (e.g. to reset a given control to its default state) which will implicitly perform the buffer flip.