Interface IXRInputValueReader<TValue>
Interface which allows for callers to read the current value from an input source.
Namespace: UnityEngine.XR.Interaction.Toolkit.Inputs.Readers
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
public interface IXRInputValueReader<TValue> : IXRInputValueReader where TValue : struct
Type Parameters
Name | Description |
---|---|
TValue |
Methods
ReadValue()
Read the current value from the input source.
Declaration
TValue ReadValue()
Returns
Type | Description |
---|---|
TValue | Returns the current value from the input source. May return |
See Also
TryReadValue(out TValue)
Try to read the current value from the input source.
Declaration
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 ReadValue() in order to avoid doing
any work when the input action is not in progress, such as when the control is not actuated.
This can be useful for performance reasons.
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 out value
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 ReadValue() instead of using the return value of this method to skip input handling.