Base class for input controls with a specific value type.
Inheritance
InputControl<TValue>
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
Declaration
public override int valueSizeInBytes { get; }
Property Value
Overrides
Declaration
public override Type valueType { get; }
Property Value
Overrides
Methods
Declaration
public override bool CompareValue(void *firstStatePtr, void *secondStatePtr)
Parameters
Type |
Name |
Description |
Void* |
firstStatePtr |
|
Void* |
secondStatePtr |
|
Returns
Overrides
Declaration
public TValue ProcessValue(TValue value)
Parameters
Type |
Name |
Description |
TValue |
value |
|
Returns
Get the control's default value.
Declaration
public TValue ReadDefaultValue()
Returns
Type |
Description |
TValue |
The control's default value.
|
Declaration
public TValue ReadUnprocessedValue()
Returns
Declaration
public abstract TValue ReadUnprocessedValueFromState(void *statePtr)
Parameters
Type |
Name |
Description |
Void* |
statePtr |
|
Returns
Declaration
public TValue ReadValue()
Returns
Type |
Description |
TValue |
The control's current value.
|
Declaration
public override object ReadValueFromBufferAsObject(void *buffer, int bufferSize)
Parameters
Type |
Name |
Description |
Void* |
buffer |
|
Int32 |
bufferSize |
|
Returns
Overrides
Declaration
public TValue ReadValueFromPreviousFrame()
Returns
Type |
Description |
TValue |
The control's value in the previous frame.
|
Declaration
public TValue ReadValueFromState(void *statePtr)
Parameters
Type |
Name |
Description |
Void* |
statePtr |
|
Returns
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 |
Void* |
statePtr |
|
Returns
Type |
Description |
Object |
The control's value as stored in statePtr .
|
Overrides
Exceptions
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 |
Void* |
statePtr |
State to read the value for the control from.
|
Void* |
bufferPtr |
Buffer to store the value in.
|
Int32 |
bufferSize |
Size of bufferPtr in bytes. Must be at least valueSizeInBytes.
If it is smaller, ArgumentException will be thrown.
|
Overrides
Exceptions
Declaration
public override void WriteValueFromBufferIntoState(void *bufferPtr, int bufferSize, void *statePtr)
Parameters
Type |
Name |
Description |
Void* |
bufferPtr |
|
Int32 |
bufferSize |
|
Void* |
statePtr |
|
Overrides
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 |
Object |
value |
Value for the control.
|
Void* |
statePtr |
State containing the control's stateBlock. Will receive
the state state as converted from the given value.
|
Overrides
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).
|
Declaration
public virtual void WriteValueIntoState(TValue value, void *statePtr)
Parameters
Type |
Name |
Description |
TValue |
value |
|
Void* |
statePtr |
|
Extension Methods
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.