docs.unity3d.com
    Show / Hide Table of Contents

    Class XRDeviceSimulator

    A component which handles mouse and keyboard input from the user and uses it to drive simulated XR controllers and an XR head mounted display (HMD).

    Inheritance
    Object
    Object
    Component
    Behaviour
    MonoBehaviour
    XRDeviceSimulator
    Inherited Members
    MonoBehaviour.IsInvoking()
    MonoBehaviour.CancelInvoke()
    MonoBehaviour.Invoke(String, Single)
    MonoBehaviour.InvokeRepeating(String, Single, Single)
    MonoBehaviour.CancelInvoke(String)
    MonoBehaviour.IsInvoking(String)
    MonoBehaviour.StartCoroutine(String)
    MonoBehaviour.StartCoroutine(String, Object)
    MonoBehaviour.StartCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(IEnumerator)
    MonoBehaviour.StopCoroutine(Coroutine)
    MonoBehaviour.StopCoroutine(String)
    MonoBehaviour.StopAllCoroutines()
    MonoBehaviour.print(Object)
    MonoBehaviour.useGUILayout
    MonoBehaviour.runInEditMode
    Behaviour.enabled
    Behaviour.isActiveAndEnabled
    Component.GetComponent(Type)
    Component.GetComponent<T>()
    Component.TryGetComponent(Type, Component)
    Component.TryGetComponent<T>(T)
    Component.GetComponent(String)
    Component.GetComponentInChildren(Type, Boolean)
    Component.GetComponentInChildren(Type)
    Component.GetComponentInChildren<T>(Boolean)
    Component.GetComponentInChildren<T>()
    Component.GetComponentsInChildren(Type, Boolean)
    Component.GetComponentsInChildren(Type)
    Component.GetComponentsInChildren<T>(Boolean)
    Component.GetComponentsInChildren<T>(Boolean, List<T>)
    Component.GetComponentsInChildren<T>()
    Component.GetComponentsInChildren<T>(List<T>)
    Component.GetComponentInParent(Type, Boolean)
    Component.GetComponentInParent(Type)
    UnityEngine.Component.GetComponentInParent<T>(System.Boolean)
    Component.GetComponentInParent<T>()
    Component.GetComponentsInParent(Type, Boolean)
    Component.GetComponentsInParent(Type)
    Component.GetComponentsInParent<T>(Boolean)
    Component.GetComponentsInParent<T>(Boolean, List<T>)
    Component.GetComponentsInParent<T>()
    Component.GetComponents(Type)
    Component.GetComponents(Type, List<Component>)
    Component.GetComponents<T>(List<T>)
    Component.GetComponents<T>()
    Component.CompareTag(String)
    Component.SendMessageUpwards(String, Object, SendMessageOptions)
    Component.SendMessageUpwards(String, Object)
    Component.SendMessageUpwards(String)
    Component.SendMessageUpwards(String, SendMessageOptions)
    Component.SendMessage(String, Object)
    Component.SendMessage(String)
    Component.SendMessage(String, Object, SendMessageOptions)
    Component.SendMessage(String, SendMessageOptions)
    Component.BroadcastMessage(String, Object, SendMessageOptions)
    Component.BroadcastMessage(String, Object)
    Component.BroadcastMessage(String)
    Component.BroadcastMessage(String, SendMessageOptions)
    Component.transform
    Component.gameObject
    Component.tag
    Object.GetInstanceID()
    Object.GetHashCode()
    Object.Equals(Object)
    Object.Instantiate(Object, Vector3, Quaternion)
    Object.Instantiate(Object, Vector3, Quaternion, Transform)
    Object.Instantiate(Object)
    Object.Instantiate(Object, Transform)
    Object.Instantiate(Object, Transform, Boolean)
    Object.Instantiate<T>(T)
    Object.Instantiate<T>(T, Vector3, Quaternion)
    Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
    Object.Instantiate<T>(T, Transform)
    Object.Instantiate<T>(T, Transform, Boolean)
    Object.Destroy(Object, Single)
    Object.Destroy(Object)
    Object.DestroyImmediate(Object, Boolean)
    Object.DestroyImmediate(Object)
    Object.FindObjectsOfType(Type)
    Object.FindObjectsOfType(Type, Boolean)
    Object.FindObjectsByType(Type, FindObjectsSortMode)
    Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode)
    Object.DontDestroyOnLoad(Object)
    Object.FindObjectsOfType<T>()
    UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsSortMode)
    UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
    UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsInactive, UnityEngine.FindObjectsSortMode)
    Object.FindObjectOfType<T>()
    UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
    UnityEngine.Object.FindFirstObjectByType<T>()
    UnityEngine.Object.FindAnyObjectByType<T>()
    UnityEngine.Object.FindFirstObjectByType<T>(UnityEngine.FindObjectsInactive)
    UnityEngine.Object.FindAnyObjectByType<T>(UnityEngine.FindObjectsInactive)
    Object.FindObjectOfType(Type)
    Object.FindFirstObjectByType(Type)
    Object.FindAnyObjectByType(Type)
    Object.FindObjectOfType(Type, Boolean)
    Object.FindFirstObjectByType(Type, FindObjectsInactive)
    Object.FindAnyObjectByType(Type, FindObjectsInactive)
    Object.ToString()
    Object.name
    Object.hideFlags
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: UnityEngine.XR.Interaction.Toolkit.Inputs.Simulation
    Syntax
    [AddComponentMenu("XR/Debug/XR Device Simulator", 11)]
    [DefaultExecutionOrder(-29991)]
    [HelpURL("https://docs.unity3d.com/Packages/com.unity.xr.interaction.toolkit@2.3/api/UnityEngine.XR.Interaction.Toolkit.Inputs.Simulation.XRDeviceSimulator.html")]
    public class XRDeviceSimulator : MonoBehaviour
    Remarks

    This class does not directly manipulate the camera or controllers which are part of the XR Origin, but rather drives them indirectly through simulated input devices.

    Use the Package Manager window to install the XR Device Simulator sample into your project to get sample mouse and keyboard bindings for Input System actions that this component expects. The sample also includes a prefab of a GameObject with this component attached that has references to those sample actions already set. To make use of this simulator, add the prefab to your scene (the prefab makes use of InputActionManager to ensure the Input System actions are enabled).

    Note that the XR Origin must read the position and rotation of the HMD and controllers by using Input System actions (such as by using ActionBasedController and TrackedPoseDriver) for this simulator to work as expected. Attempting to use XR input subsystem device methods (such as by using XRController and TrackedPoseDriver) will not work as expected since this simulator depends on the Input System to drive the simulated devices.

    Properties

    axis2DAction

    The Input System Action used to control the value of one or more 2D Axis controls on the manipulated controller device(s). Must be a Value Vector2Control.

    Declaration
    public InputActionReference axis2DAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    Remarks

    togglePrimary2DAxisTargetAction and toggleSecondary2DAxisTargetAction toggle enables the ability to manipulate 2D Axis controls on the simulated controllers, and this axis2DAction actually controls the value of them while those controller devices are being manipulated.
    Typically bound to WASD on a keyboard, and controls the primary and/or secondary 2D Axis controls on them.

    axis2DTargets

    One or more 2D Axis controls that keyboard input should apply to (or none).

    Declaration
    public XRDeviceSimulator.Axis2DTargets axis2DTargets { get; set; }
    Property Value
    Type Description
    XRDeviceSimulator.Axis2DTargets
    Remarks

    Used to control a combination of the position (Position), primary 2D axis (Primary2DAxis), or secondary 2D axis (Secondary2DAxis) of manipulated device(s).

    See Also
    keyboardXTranslateAction
    keyboardYTranslateAction
    keyboardZTranslateAction
    axis2DAction
    restingHandAxis2DAction

    cameraTransform

    The Transform that contains the Camera. This is usually the "Head" of XR Origins. Automatically set to main if unset.

    Declaration
    public Transform cameraTransform { get; set; }
    Property Value
    Type Description
    Transform

    controllerActionAsset

    Input Action asset containing controls for the simulated controllers. Unity will automatically enable and disable it as needed.

    Declaration
    public InputActionAsset controllerActionAsset { get; set; }
    Property Value
    Type Description
    InputActionAsset

    cycleDevicesAction

    The Input System Action used to cycle between the different available devices. Must be a ButtonControl.

    Declaration
    public InputActionReference cycleDevicesAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    See Also
    manipulateHeadAction
    manipulateLeftAction
    manipulateRightAction

    desiredCursorLockMode

    The desired cursor lock mode to toggle to from None (either Locked or Confined).

    Declaration
    public CursorLockMode desiredCursorLockMode { get; set; }
    Property Value
    Type Description
    CursorLockMode
    See Also
    toggleCursorLockAction

    deviceSimulatorActionAsset

    Input Action asset containing controls for the simulator itself. Unity will automatically enable and disable it with this component.

    Declaration
    public InputActionAsset deviceSimulatorActionAsset { get; set; }
    Property Value
    Type Description
    InputActionAsset

    deviceSimulatorUI

    The optional Device Simulator UI prefab to use along with the XR Device Simulator.

    Declaration
    public GameObject deviceSimulatorUI { get; set; }
    Property Value
    Type Description
    GameObject

    gripAction

    The Input System Action used to control the Grip control of the manipulated controller device(s). Must be a ButtonControl.

    Declaration
    public InputActionReference gripAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    gripAmount

    The amount of the simulated grip on the controller when the Grip control is pressed.

    Declaration
    public float gripAmount { get; set; }
    Property Value
    Type Description
    Single
    See Also
    gripAction

    hmdIsTracked

    Whether the HMD should report the pose as fully tracked or unavailable/inferred.

    Declaration
    public bool hmdIsTracked { get; set; }
    Property Value
    Type Description
    Boolean

    hmdTrackingState

    Which tracking values the HMD should report as being valid or meaningful to use, which could mean either tracked or inferred.

    Declaration
    public InputTrackingState hmdTrackingState { get; set; }
    Property Value
    Type Description
    InputTrackingState

    instance

    The runtime instance of the XR Device Simulator.

    Declaration
    public static XRDeviceSimulator instance { get; }
    Property Value
    Type Description
    XRDeviceSimulator

    keyboardBodyTranslateMultiplier

    Speed multiplier applied for body translation when triggered by keyboard input.

    Declaration
    public float keyboardBodyTranslateMultiplier { get; set; }
    Property Value
    Type Description
    Single
    See Also
    keyboardXTranslateSpeed
    keyboardYTranslateSpeed
    keyboardZTranslateSpeed

    keyboardTranslateSpace

    The coordinate space in which keyboard translation should operate.

    Declaration
    public XRDeviceSimulator.Space keyboardTranslateSpace { get; set; }
    Property Value
    Type Description
    XRDeviceSimulator.Space
    See Also
    XRDeviceSimulator.Space
    mouseTranslateSpace
    keyboardXTranslateAction
    keyboardYTranslateAction
    keyboardZTranslateAction

    keyboardXTranslateAction

    The Input System Action used to translate in the x-axis (left/right) while held. Must be a Value AxisControl.

    Declaration
    public InputActionReference keyboardXTranslateAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    keyboardXTranslateSpeed

    Speed of translation in the x-axis (left/right) when triggered by keyboard input.

    Declaration
    public float keyboardXTranslateSpeed { get; set; }
    Property Value
    Type Description
    Single
    See Also
    keyboardXTranslateAction
    keyboardYTranslateSpeed
    keyboardZTranslateSpeed

    keyboardYTranslateAction

    The Input System Action used to translate in the y-axis (up/down) while held. Must be a Value AxisControl.

    Declaration
    public InputActionReference keyboardYTranslateAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    keyboardYTranslateSpeed

    Speed of translation in the y-axis (up/down) when triggered by keyboard input.

    Declaration
    public float keyboardYTranslateSpeed { get; set; }
    Property Value
    Type Description
    Single
    See Also
    keyboardYTranslateAction
    keyboardXTranslateSpeed
    keyboardZTranslateSpeed

    keyboardZTranslateAction

    The Input System Action used to translate in the z-axis (forward/back) while held. Must be a Value AxisControl.

    Declaration
    public InputActionReference keyboardZTranslateAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    keyboardZTranslateSpeed

    Speed of translation in the z-axis (forward/back) when triggered by keyboard input.

    Declaration
    public float keyboardZTranslateSpeed { get; set; }
    Property Value
    Type Description
    Single
    See Also
    keyboardZTranslateAction
    keyboardXTranslateSpeed
    keyboardYTranslateSpeed

    leftControllerIsTracked

    Whether the left-hand controller should report the pose as fully tracked or unavailable/inferred.

    Declaration
    public bool leftControllerIsTracked { get; set; }
    Property Value
    Type Description
    Boolean

    leftControllerTrackingState

    Which tracking values the left-hand controller should report as being valid or meaningful to use, which could mean either tracked or inferred.

    Declaration
    public InputTrackingState leftControllerTrackingState { get; set; }
    Property Value
    Type Description
    InputTrackingState

    manipulateHeadAction

    The Input System Action used to enable manipulation of the HMD while held. Must be a ButtonControl.

    Declaration
    public InputActionReference manipulateHeadAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    manipulateLeftAction

    The Input System Action used to enable manipulation of the left-hand controller while held. Must be a ButtonControl.

    Declaration
    public InputActionReference manipulateLeftAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    Remarks

    Note that if controls on the left-hand controller are actuated when this action is released, those controls will continue to remain actuated. This is to allow for multi-hand interactions without needing to have dedicated bindings for manipulating each controller separately and concurrently.

    See Also
    manipulateRightAction
    toggleManipulateLeftAction

    manipulateRightAction

    The Input System Action used to enable manipulation of the right-hand controller while held. Must be a ButtonControl.

    Declaration
    public InputActionReference manipulateRightAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    Remarks

    Note that if controls on the right-hand controller are actuated when this action is released, those controls will continue to remain actuated. This is to allow for multi-hand interactions without needing to have dedicated bindings for manipulating each controller separately and concurrently.

    See Also
    manipulateLeftAction

    manipulatingFPS

    Whether the simulator is manipulating the HMD, Left Controller, and Right Controller as if the whole player was turning their torso, similar to a typical FPS style.

    Declaration
    public bool manipulatingFPS { get; }
    Property Value
    Type Description
    Boolean

    manipulatingLeftController

    Whether the simulator is manipulating the Left Controller.

    Declaration
    public bool manipulatingLeftController { get; }
    Property Value
    Type Description
    Boolean

    manipulatingRightController

    Whether the simulator is manipulating the Right Controller.

    Declaration
    public bool manipulatingRightController { get; }
    Property Value
    Type Description
    Boolean

    menuAction

    The Input System Action used to control the Menu control of the manipulated controller device(s). Must be a ButtonControl.

    Declaration
    public InputActionReference menuAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    mouseDeltaAction

    The Input System Action used to translate or rotate by a scaled amount along or about the x- and y-axes. Must be a Value Vector2Control.

    Declaration
    public InputActionReference mouseDeltaAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    Remarks

    Typically bound to the screen-space motion delta of the mouse in pixels.

    See Also
    mouseScrollAction

    mouseScrollAction

    The Input System Action used to translate or rotate by a scaled amount along or about the z-axis. Must be a Value Vector2Control.

    Declaration
    public InputActionReference mouseScrollAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    Remarks

    Typically bound to the horizontal and vertical scroll wheels, though only the vertical is used.

    See Also
    mouseDeltaAction

    mouseScrollRotateSensitivity

    Sensitivity of rotation along the z-axis (roll) when triggered by mouse scroll input.

    Declaration
    public float mouseScrollRotateSensitivity { get; set; }
    Property Value
    Type Description
    Single
    See Also
    mouseScrollAction
    mouseXRotateSensitivity
    mouseYRotateSensitivity

    mouseScrollTranslateSensitivity

    Sensitivity of translation in the z-axis (forward/back) when triggered by mouse scroll input.

    Declaration
    public float mouseScrollTranslateSensitivity { get; set; }
    Property Value
    Type Description
    Single
    See Also
    mouseScrollAction
    mouseXTranslateSensitivity
    mouseYTranslateSensitivity

    mouseTransformationMode

    The transformation mode in which the mouse should operate.

    Declaration
    public XRDeviceSimulator.TransformationMode mouseTransformationMode { get; set; }
    Property Value
    Type Description
    XRDeviceSimulator.TransformationMode
    See Also
    XRDeviceSimulator.TransformationMode

    mouseTranslateSpace

    The coordinate space in which mouse translation should operate.

    Declaration
    public XRDeviceSimulator.Space mouseTranslateSpace { get; set; }
    Property Value
    Type Description
    XRDeviceSimulator.Space
    See Also
    XRDeviceSimulator.Space
    keyboardTranslateSpace

    mouseXRotateSensitivity

    Sensitivity of rotation along the x-axis (pitch) when triggered by mouse input.

    Declaration
    public float mouseXRotateSensitivity { get; set; }
    Property Value
    Type Description
    Single
    See Also
    mouseDeltaAction
    mouseYRotateSensitivity
    mouseScrollRotateSensitivity

    mouseXTranslateSensitivity

    Sensitivity of translation in the x-axis (left/right) when triggered by mouse input.

    Declaration
    public float mouseXTranslateSensitivity { get; set; }
    Property Value
    Type Description
    Single
    See Also
    mouseDeltaAction
    mouseYTranslateSensitivity
    mouseScrollTranslateSensitivity

    mouseYRotateInvert

    A boolean value of whether to invert the y-axis of mouse input when rotating by mouse input. A false value (default) means typical FPS style where moving the mouse up/down pitches up/down. A true value means flight control style where moving the mouse up/down pitches down/up.

    Declaration
    public bool mouseYRotateInvert { get; set; }
    Property Value
    Type Description
    Boolean

    mouseYRotateSensitivity

    Sensitivity of rotation along the y-axis (yaw) when triggered by mouse input.

    Declaration
    public float mouseYRotateSensitivity { get; set; }
    Property Value
    Type Description
    Single
    See Also
    mouseDeltaAction
    mouseXRotateSensitivity
    mouseScrollRotateSensitivity

    mouseYTranslateSensitivity

    Sensitivity of translation in the y-axis (up/down) when triggered by mouse input.

    Declaration
    public float mouseYTranslateSensitivity { get; set; }
    Property Value
    Type Description
    Single
    See Also
    mouseDeltaAction
    mouseXTranslateSensitivity
    mouseScrollTranslateSensitivity

    negateMode

    Is the user currently using negate mode.

    Declaration
    public bool negateMode { get; }
    Property Value
    Type Description
    Boolean
    See Also
    mouseTransformationMode

    negateModeAction

    The Input System Action used to cause the manipulated device(s) to rotate when moving the mouse while held when it would normally translate, and vice-versa. Must be a ButtonControl.

    Declaration
    public InputActionReference negateModeAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    Remarks

    Can be used to temporarily change the mouse transformation mode to the other mode while held for making quick adjustments.

    See Also
    toggleMouseTransformationModeAction

    primary2DAxisClickAction

    The Input System Action used to control the Primary2DAxisClick control of the manipulated controller device(s). Must be a ButtonControl.

    Declaration
    public InputActionReference primary2DAxisClickAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    primary2DAxisTouchAction

    The Input System Action used to control the Primary2DAxisTouch control of the manipulated controller device(s). Must be a ButtonControl.

    Declaration
    public InputActionReference primary2DAxisTouchAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    primaryButtonAction

    The Input System Action used to control the PrimaryButton control of the manipulated controller device(s). Must be a ButtonControl.

    Declaration
    public InputActionReference primaryButtonAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    primaryTouchAction

    The Input System Action used to control the PrimaryTouch control of the manipulated controller device(s). Must be a ButtonControl.

    Declaration
    public InputActionReference primaryTouchAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    removeOtherHMDDevices

    This boolean value indicates whether or not we remove other XRHMD devices in this session so that they don't conflict with the XRDeviceSimulator. A true value (default) means we remove all other XRHMD devices except the XRSimulatedHMD generated by the XRDeviceSimulator. A false value means we do not remove any other XRHMD devices.

    Declaration
    public bool removeOtherHMDDevices { get; set; }
    Property Value
    Type Description
    Boolean

    resetAction

    The Input System Action used to cause the manipulated device(s) to reset position or rotation (depending on the effective manipulation mode). Must be a ButtonControl.

    Declaration
    public InputActionReference resetAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    Remarks

    Resets position to zero and rotation to identity. May be combined with axis constraints (xConstraintAction, yConstraintAction, and zConstraintAction).

    restingHandAxis2DAction

    The Input System Action used to control one or more 2D Axis controls on the opposite hand of the exclusively manipulated controller device. Must be a Value Vector2Control.

    Declaration
    public InputActionReference restingHandAxis2DAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    Remarks

    Typically bound to Q and E on a keyboard for the horizontal component, and controls the opposite hand's 2D Axis controls when manipulating one (and only one) controller. Can be used to quickly and simultaneously control the 2D Axis on the other hand's controller. In a typical setup of continuous movement bound on the left-hand controller stick, and turning bound on the right-hand controller stick, while exclusively manipulating the left-hand controller to move, this action can be used to trigger turning.

    See Also
    axis2DAction

    rightControllerIsTracked

    Whether the right-hand controller should report the pose as fully tracked or unavailable/inferred.

    Declaration
    public bool rightControllerIsTracked { get; set; }
    Property Value
    Type Description
    Boolean

    rightControllerTrackingState

    Which tracking values the right-hand controller should report as being valid or meaningful to use, which could mean either tracked or inferred.

    Declaration
    public InputTrackingState rightControllerTrackingState { get; set; }
    Property Value
    Type Description
    InputTrackingState

    rotateModeOverrideAction

    The Input System Action used to cause the manipulated device(s) to rotate when moving the mouse when held. Must be a ButtonControl.

    Declaration
    public InputActionReference rotateModeOverrideAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    Remarks

    Forces rotation mode when held, no matter what the current mouse transformation mode is.

    See Also
    negateModeAction

    secondary2DAxisClickAction

    The Input System Action used to control the Secondary2DAxisClick control of the manipulated controller device(s). Must be a ButtonControl.

    Declaration
    public InputActionReference secondary2DAxisClickAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    secondary2DAxisTouchAction

    The Input System Action used to control the Secondary2DAxisTouch control of the manipulated controller device(s). Must be a ButtonControl.

    Declaration
    public InputActionReference secondary2DAxisTouchAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    secondaryButtonAction

    The Input System Action used to control the SecondaryButton control of the manipulated controller device(s). Must be a ButtonControl.

    Declaration
    public InputActionReference secondaryButtonAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    secondaryTouchAction

    The Input System Action used to control the SecondaryTouch control of the manipulated controller device(s). Must be a ButtonControl.

    Declaration
    public InputActionReference secondaryTouchAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    stopManipulationAction

    The Input System Action used to stop all manipulation. Must be a ButtonControl.

    Declaration
    public InputActionReference stopManipulationAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    toggleCursorLockAction

    The Input System Action used to toggle the cursor lock mode for the game window when pressed. Must be a ButtonControl.

    Declaration
    public InputActionReference toggleCursorLockAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    See Also
    lockState
    desiredCursorLockMode

    toggleDevicePositionTargetAction

    The Input System Action used to toggle enable translation from keyboard inputs when pressed. Must be a ButtonControl.

    Declaration
    public InputActionReference toggleDevicePositionTargetAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    See Also
    keyboardXTranslateAction
    keyboardYTranslateAction
    keyboardZTranslateAction

    toggleManipulateBodyAction

    The Input System Action used to toggle enable looking around with the HMD and controllers. Must be a ButtonControl.

    Declaration
    public InputActionReference toggleManipulateBodyAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    toggleManipulateLeftAction

    The Input System Action used to toggle enable manipulation of the left-hand controller when pressed. Must be a ButtonControl.

    Declaration
    public InputActionReference toggleManipulateLeftAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    See Also
    manipulateLeftAction
    toggleManipulateRightAction

    toggleManipulateRightAction

    The Input System Action used to toggle enable manipulation of the right-hand controller when pressed. Must be a ButtonControl.

    Declaration
    public InputActionReference toggleManipulateRightAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    See Also
    manipulateRightAction
    toggleManipulateLeftAction

    toggleMouseTransformationModeAction

    The Input System Action used to toggle between translating or rotating the manipulated device(s) when moving the mouse when pressed. Must be a ButtonControl.

    Declaration
    public InputActionReference toggleMouseTransformationModeAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    togglePrimary2DAxisTargetAction

    The Input System action used to toggle enable manipulation of the Primary2DAxis of the controllers when pressed. Must be a ButtonControl.

    Declaration
    public InputActionReference togglePrimary2DAxisTargetAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    See Also
    toggleSecondary2DAxisTargetAction
    toggleDevicePositionTargetAction
    axis2DAction

    toggleSecondary2DAxisTargetAction

    The Input System action used to toggle enable manipulation of the Secondary2DAxis of the controllers when pressed. Must be a ButtonControl.

    Declaration
    public InputActionReference toggleSecondary2DAxisTargetAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    See Also
    togglePrimary2DAxisTargetAction
    toggleDevicePositionTargetAction
    axis2DAction

    triggerAction

    The Input System Action used to control the Trigger control of the manipulated controller device(s). Must be a ButtonControl.

    Declaration
    public InputActionReference triggerAction { get; set; }
    Property Value
    Type Description
    InputActionReference

    triggerAmount

    The amount of the simulated trigger pull on the controller when the Trigger control is pressed.

    Declaration
    public float triggerAmount { get; set; }
    Property Value
    Type Description
    Single
    See Also
    triggerAction

    xConstraintAction

    The Input System Action used to constrain the translation or rotation to the x-axis when moving the mouse or resetting. May be combined with another axis constraint to constrain to a plane. Must be a ButtonControl.

    Declaration
    public InputActionReference xConstraintAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    See Also
    yConstraintAction
    zConstraintAction

    yConstraintAction

    The Input System Action used to constrain the translation or rotation to the y-axis when moving the mouse or resetting. May be combined with another axis constraint to constrain to a plane. Must be a ButtonControl.

    Declaration
    public InputActionReference yConstraintAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    See Also
    xConstraintAction
    zConstraintAction

    zConstraintAction

    The Input System Action used to constrain the translation or rotation to the z-axis when moving the mouse or resetting. May be combined with another axis constraint to constrain to a plane. Must be a ButtonControl.

    Declaration
    public InputActionReference zConstraintAction { get; set; }
    Property Value
    Type Description
    InputActionReference
    See Also
    xConstraintAction
    yConstraintAction

    Methods

    AddDevices()

    Add simulated XR devices to the Input System.

    Declaration
    protected virtual void AddDevices()

    Awake()

    See MonoBehaviour.

    Declaration
    protected virtual void Awake()

    GetResetScale()

    Gets a Vector3 that can be multiplied component-wise with another Vector3 to reset components of the Vector3, based on axis constraint inputs.

    Declaration
    protected Vector3 GetResetScale()
    Returns
    Type Description
    Vector3
    See Also
    resetAction
    xConstraintAction
    yConstraintAction
    zConstraintAction

    Negate(XRDeviceSimulator.TransformationMode)

    Returns the negated XRDeviceSimulator.TransformationMode of the given mode.

    Declaration
    public static XRDeviceSimulator.TransformationMode Negate(XRDeviceSimulator.TransformationMode mode)
    Parameters
    Type Name Description
    XRDeviceSimulator.TransformationMode mode

    The XRDeviceSimulator.TransformationMode to get the negated mode of.

    Returns
    Type Description
    XRDeviceSimulator.TransformationMode

    Returns Translate if given Rotate, and vice versa.

    OnDisable()

    See MonoBehaviour.

    Declaration
    protected virtual void OnDisable()

    OnEnable()

    See MonoBehaviour.

    Declaration
    protected virtual void OnEnable()

    ProcessAnalogButtonControlInput(ref XRSimulatedControllerState)

    Update the state of manipulated controller device related to analog values only. This is used to adjust the grip and trigger values when the user adjusts the slider when not manipulating the device.

    Declaration
    protected virtual void ProcessAnalogButtonControlInput(ref XRSimulatedControllerState controllerState)
    Parameters
    Type Name Description
    XRSimulatedControllerState controllerState

    The controller state that will be processed.

    ProcessAxis2DControlInput()

    Process input from the user and update the state of manipulated controller device(s) related to 2D Axis input controls.

    Declaration
    protected virtual void ProcessAxis2DControlInput()

    ProcessButtonControlInput(ref XRSimulatedControllerState)

    Process input from the user and update the state of manipulated controller device(s) related to button input controls.

    Declaration
    protected virtual void ProcessButtonControlInput(ref XRSimulatedControllerState controllerState)
    Parameters
    Type Name Description
    XRSimulatedControllerState controllerState

    The controller state that will be processed.

    ProcessControlInput()

    Process input from the user and update the state of manipulated controller device(s) related to input controls.

    Declaration
    protected virtual void ProcessControlInput()

    ProcessPoseInput()

    Process input from the user and update the state of manipulated device(s) related to position and rotation.

    Declaration
    protected virtual void ProcessPoseInput()

    RemoveDevices()

    Remove simulated XR devices from the Input System.

    Declaration
    protected virtual void RemoveDevices()

    Update()

    See MonoBehaviour.

    Declaration
    protected virtual void Update()

    See Also

    XRSimulatedController
    XRSimulatedHMD
    SimulatedInputLayoutLoader
    In This Article
    • Properties
      • axis2DAction
      • axis2DTargets
      • cameraTransform
      • controllerActionAsset
      • cycleDevicesAction
      • desiredCursorLockMode
      • deviceSimulatorActionAsset
      • deviceSimulatorUI
      • gripAction
      • gripAmount
      • hmdIsTracked
      • hmdTrackingState
      • instance
      • keyboardBodyTranslateMultiplier
      • keyboardTranslateSpace
      • keyboardXTranslateAction
      • keyboardXTranslateSpeed
      • keyboardYTranslateAction
      • keyboardYTranslateSpeed
      • keyboardZTranslateAction
      • keyboardZTranslateSpeed
      • leftControllerIsTracked
      • leftControllerTrackingState
      • manipulateHeadAction
      • manipulateLeftAction
      • manipulateRightAction
      • manipulatingFPS
      • manipulatingLeftController
      • manipulatingRightController
      • menuAction
      • mouseDeltaAction
      • mouseScrollAction
      • mouseScrollRotateSensitivity
      • mouseScrollTranslateSensitivity
      • mouseTransformationMode
      • mouseTranslateSpace
      • mouseXRotateSensitivity
      • mouseXTranslateSensitivity
      • mouseYRotateInvert
      • mouseYRotateSensitivity
      • mouseYTranslateSensitivity
      • negateMode
      • negateModeAction
      • primary2DAxisClickAction
      • primary2DAxisTouchAction
      • primaryButtonAction
      • primaryTouchAction
      • removeOtherHMDDevices
      • resetAction
      • restingHandAxis2DAction
      • rightControllerIsTracked
      • rightControllerTrackingState
      • rotateModeOverrideAction
      • secondary2DAxisClickAction
      • secondary2DAxisTouchAction
      • secondaryButtonAction
      • secondaryTouchAction
      • stopManipulationAction
      • toggleCursorLockAction
      • toggleDevicePositionTargetAction
      • toggleManipulateBodyAction
      • toggleManipulateLeftAction
      • toggleManipulateRightAction
      • toggleMouseTransformationModeAction
      • togglePrimary2DAxisTargetAction
      • toggleSecondary2DAxisTargetAction
      • triggerAction
      • triggerAmount
      • xConstraintAction
      • yConstraintAction
      • zConstraintAction
    • Methods
      • AddDevices()
      • Awake()
      • GetResetScale()
      • Negate(XRDeviceSimulator.TransformationMode)
      • OnDisable()
      • OnEnable()
      • ProcessAnalogButtonControlInput(ref XRSimulatedControllerState)
      • ProcessAxis2DControlInput()
      • ProcessButtonControlInput(ref XRSimulatedControllerState)
      • ProcessControlInput()
      • ProcessPoseInput()
      • RemoveDevices()
      • Update()
    • See Also
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023