Class KeyCodeField
- Namespace
- UILib.Components
- Assembly
- UILib.dll
A component which allows you to get
a KeyCode from the user.
This could be a key or mouse button.
public class KeyCodeField : Button
- Inheritance
-
KeyCodeField
- Inherited Members
Constructors
KeyCodeField(KeyCode, int)
Initializes the keycode field.
public KeyCodeField(KeyCode value, int fontSize)
Parameters
valueKeyCodeThe default value of this field
fontSizeintThe font size to use
Properties
onCancel
An event for listening to when the user cancels inputting a key/mouse button.
public UnityEvent onCancel { get; }
Property Value
- UnityEvent
onValueChanged
An event for listening to when the user actually inputs a key or presses a mouse button.
Passes the KeyCode that was read to listeners.
A result of KeyCode.None means the key was unbound.
public ValueEvent<KeyCode> onValueChanged { get; }
Property Value
- ValueEvent<KeyCode>
value
The current value stored in this field.
public KeyCode value { get; }
Property Value
- KeyCode
Methods
KeyAsString(KeyCode)
Translates a KeyCode into a more user
friendly string.
This is used internally to update the key being displayed, but it's public because it's a useful method.
public static string KeyAsString(KeyCode key)
Parameters
keyKeyCodeThe
KeyCodeto translate
Returns
- string
The key as a user friendly value
SetValue(KeyCode)
Sets the current value stored in this field.
public void SetValue(KeyCode value)
Parameters
valueKeyCodeThe value to set