Class XRInputDeviceValueReader<TValue>
A Scriptable
Inheritance
Inherited Members
Namespace: UnityEngine .XR.Interaction.Toolkit.Inputs.Readers
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
public abstract class XRInputDeviceValueReader<TValue> : XRInputDeviceValueReader, IXRInputValueReader<TValue>, IXRInputValueReader where TValue : struct
Type Parameters
Properties
usage
The name of the input feature usage to read.
Declaration
public InputFeatureUsageString<TValue> usage { get; set; }
Property Value
Type | Description |
---|---|
Input |
Methods
ReadBoolValue()
Read the value of the input as a bool.
Declaration
protected bool ReadBoolValue()
Returns
ReadFloatValue()
Read the value of the input as a float.
Declaration
protected float ReadFloatValue()
Returns
ReadInputTrackingStateValue()
Read the value of the input as an Input
Declaration
protected InputTrackingState ReadInputTrackingStateValue()
Returns
Type | Description |
---|---|
Input |
Returns the value of the input as an Input |
ReadQuaternionValue()
Read the value of the input as a Quaternion.
Declaration
protected Quaternion ReadQuaternionValue()
Returns
Type | Description |
---|---|
Quaternion | Returns the value of the input as a Quaternion. |
ReadUIntValue()
Read the value of the input as an uint.
Declaration
protected uint ReadUIntValue()
Returns
ReadValue()
Read the current value from the input source.
Declaration
public abstract TValue ReadValue()
Returns
Type | Description |
---|---|
TValue | Returns the current value from the input source. May return |
ReadVector2Value()
Read the value of the input as a Vector2.
Declaration
protected Vector2 ReadVector2Value()
Returns
ReadVector3Value()
Read the value of the input as a Vector3.
Declaration
protected Vector3 ReadVector3Value()
Returns
RefreshInputDeviceIfNeeded()
Updates the found input device used to read input from if it isn't valid. This should be called before attempting to read a value from the input device.
Declaration
protected bool RefreshInputDeviceIfNeeded()
Returns
Type | Description |
---|---|
bool | Returns true if the input device is valid or if a valid one with matching characteristics was found. |
TryReadBoolValue(out bool)
Try to read the value of the input as a bool.
Declaration
protected bool TryReadBoolValue(out bool value)
Parameters
Type | Name | Description |
---|---|---|
bool | value | When this method returns true, the value read. Otherwise, the default for the type. |
Returns
TryReadFloatValue(out float)
Try to read the value of the input as a float.
Declaration
protected bool TryReadFloatValue(out float value)
Parameters
Type | Name | Description |
---|---|---|
float | value | When this method returns true, the value read. Otherwise, the default for the type. |
Returns
TryReadInputTrackingStateValue(out InputTrackingState)
Try to read the value of the input as an Input
Declaration
protected bool TryReadInputTrackingStateValue(out InputTrackingState value)
Parameters
Type | Name | Description |
---|---|---|
Input |
value | When this method returns true, the value read. Otherwise, the default for the type. |
Returns
TryReadQuaternionValue(out Quaternion)
Try to read the value of the input as a Quaternion.
Declaration
protected bool TryReadQuaternionValue(out Quaternion value)
Parameters
Type | Name | Description |
---|---|---|
Quaternion | value | When this method returns true, the value read. Otherwise, the default for the type. |
Returns
TryReadUIntValue(out uint)
Try to read the value of the input as an uint.
Declaration
protected bool TryReadUIntValue(out uint value)
Parameters
Type | Name | Description |
---|---|---|
uint | value | When this method returns true, the value read. Otherwise, the default for the type. |
Returns
TryReadValue(out TValue)
Try to read the current value from the input source.
Declaration
public abstract bool TryReadValue(out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | When this method returns, contains the current value from the input source. May return |
Returns
Type | Description |
---|---|
bool | Returns true if the current value was able to be read (and for actions, also if in progress). |
Remarks
You can use the return value of this method instead of only using Read
If an input processor on an input action returns a different value from the default TValue
when the input action is not in progress, the outvalue
returned by
this method may not be default(TValue)
as is typically the case for Try
- methods. If you need
to support processors that return a different value from the default when the control is not actuated,
you should use Read
TryReadVector2Value(out Vector2)
Try to read the value of the input as a Vector2.
Declaration
protected bool TryReadVector2Value(out Vector2 value)
Parameters
Type | Name | Description |
---|---|---|
Vector2 | value | When this method returns true, the value read. Otherwise, the default for the type. |
Returns
TryReadVector3Value(out Vector3)
Try to read the value of the input as a Vector3.
Declaration
protected bool TryReadVector3Value(out Vector3 value)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | value | When this method returns true, the value read. Otherwise, the default for the type. |