Class InputControl<TValue>
Base class for input controls with a specific value type.
Inherited Members
Namespace: UnityEngine.Experimental.Input
Syntax
public abstract class InputControl<TValue> : InputControl where TValue : struct
Type Parameters
Name | Description |
---|---|
TValue | Type of value captured by the control. Note that this does not mean that the control has to store data in the given value format. A control that captures float values, for example, may be stored in state as byte values instead. |
Properties
valueSizeInBytes
Declaration
public override int valueSizeInBytes { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Overrides
valueType
Declaration
public override Type valueType { get; }
Property Value
Type | Description |
---|---|
Type |
Overrides
Methods
CompareValue(Void*, Void*)
Declaration
public override bool CompareValue(void *firstStatePtr, void *secondStatePtr)
Parameters
Type | Name | Description |
---|---|---|
System.Void* | firstStatePtr | |
System.Void* | secondStatePtr |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
ProcessValue(TValue)
Declaration
public TValue ProcessValue(TValue value)
Parameters
Type | Name | Description |
---|---|---|
TValue | value |
Returns
Type | Description |
---|---|
TValue |
ReadDefaultValue()
Get the control's default value.
Declaration
public TValue ReadDefaultValue()
Returns
Type | Description |
---|---|
TValue | The control's default value. |
Remarks
This is not necessarily equivalent to default(TValue)
. A control's default value is determined
by reading its value from the default state (defaultStatePtr) which in turn
is determined from settings in the control's registered layout (
ReadUnprocessedValue()
Declaration
public TValue ReadUnprocessedValue()
Returns
Type | Description |
---|---|
TValue |
ReadUnprocessedValueFromState(Void*)
Declaration
public abstract TValue ReadUnprocessedValueFromState(void *statePtr)
Parameters
Type | Name | Description |
---|---|---|
System.Void* | statePtr |
Returns
Type | Description |
---|---|
TValue |
ReadValue()
Get the control's current value as read from currentStatePtr
Declaration
public TValue ReadValue()
Returns
Type | Description |
---|---|
TValue | The control's current value. |
Remarks
This can only be called on devices that have been added to the system (added).
ReadValueFromPreviousFrame()
Get the control's value from the previous frame (previousFrameStatePtr).
Declaration
public TValue ReadValueFromPreviousFrame()
Returns
Type | Description |
---|---|
TValue | The control's value in the previous frame. |
ReadValueFromState(Void*)
Declaration
public TValue ReadValueFromState(void *statePtr)
Parameters
Type | Name | Description |
---|---|---|
System.Void* | statePtr |
Returns
Type | Description |
---|---|
TValue |
ReadValueFromStateAsObject(Void*)
Read the control's final, processed value from the given state and return the value as an object.
Declaration
public override object ReadValueFromStateAsObject(void *statePtr)
Parameters
Type | Name | Description |
---|---|---|
System.Void* | statePtr |
Returns
Type | Description |
---|---|
System.Object | The control's value as stored in statePtr. |
Overrides
Remarks
This method allocates GC memory and should not be used during normal gameplay operation.
See Also
ReadValueFromStateIntoBuffer(Void*, Void*, Int32)
Read the control's final, processed value from the given state and store it in the given buffer.
Declaration
public override void ReadValueFromStateIntoBuffer(void *statePtr, void *bufferPtr, int bufferSize)
Parameters
Type | Name | Description |
---|---|---|
System.Void* | statePtr | State to read the value for the control from. |
System.Void* | bufferPtr | Buffer to store the value in. |
System.Int32 | bufferSize | Size of bufferPtr in bytes. Must be at least valueSizeInBytes.
If it is smaller, |
Overrides
See Also
WriteValueFromBufferIntoState(Void*, Int32, Void*)
Declaration
public override void WriteValueFromBufferIntoState(void *bufferPtr, int bufferSize, void *statePtr)
Parameters
Type | Name | Description |
---|---|---|
System.Void* | bufferPtr | |
System.Int32 | bufferSize | |
System.Void* | statePtr |
Overrides
WriteValueFromObjectIntoState(Object, Void*)
Read a value object and store it as state in the given memory.
Declaration
public override void WriteValueFromObjectIntoState(object value, void *statePtr)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | Value for the control. |
System.Void* | statePtr | State containing the control's stateBlock. Will receive the state 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.
See Also
WriteValueIntoState(TValue, Void*)
Declaration
public virtual void WriteValueIntoState(TValue value, void *statePtr)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | |
System.Void* | statePtr |