Class DeviceOrientationControl
A control reading a DeviceOrientation value.
Inherited Members
Namespace: UnityEngine.InputSystem.Controls
Assembly: Unity.InputSystem.dll
Syntax
public class DeviceOrientationControl : InputControl<DeviceOrientation>
Remarks
This is used by DeviceOrientationSensor to report the physical orientation of the device
(see orientation). It provides feature parity with the legacy
UnityEngine.Input.deviceOrientation property.
The value describes how the physical device is being held relative to gravity - for example held upright, rotated to landscape, or lying flat face up or face down. The individual poses, and the reference orientation each one corresponds to, are defined on the DeviceOrientation enum members.
Constructors
DeviceOrientationControl()
Default-initialize the control.
Declaration
public DeviceOrientationControl()
Remarks
Format of the control is FormatInt by default.
See Also
Methods
ReadUnprocessedValueFromState(void*)
Read value from provided statePtr.
Declaration
public override DeviceOrientation ReadUnprocessedValueFromState(void* statePtr)
Parameters
| Type | Name | Description |
|---|---|---|
| void* | statePtr | State pointer to read from. |
Returns
| Type | Description |
|---|---|
| DeviceOrientation | The controls current value. |
Overrides
Remarks
Read value from provided statePtr without any caching.
See Also
WriteValueIntoState(DeviceOrientation, void*)
Write a value into state at the given memory.
Declaration
public override void WriteValueIntoState(DeviceOrientation value, void* statePtr)
Parameters
| Type | Name | Description |
|---|---|---|
| DeviceOrientation | value | Value for the control to store in the state. |
| void* | statePtr | State containing the control's stateBlock. Will receive the state as converted from the given value. |
Overrides
Remarks
Writing values will NOT apply processors to the given value. This can mean that when reading a value from a control after it has been written to its state, the resulting value differs from what was written.
Exceptions
| Type | Condition |
|---|---|
| NotSupportedException | The control does not support writing. This is the case, for example, that compute values (such as the magnitude of a vector). |