Table of Contents

Class KeyCodeUtils

Namespace
Nautilus.Utility
Assembly
Nautilus.dll
A collection of UnityEngine.KeyCode related utility methods.
public static class KeyCodeUtils
Inheritance
KeyCodeUtils
Inherited Members

Methods

GetAnalogValueForKey(string)

Gets the analog value for a key by string value, following the same logic as GameInput.GetAnalogValueForButton(GameInput.Button)
public static float GetAnalogValueForKey(string s)

Parameters

s string

Returns

float
1f while a key is being held, otherwise 0f
See Also

GetAnalogValueForKey(KeyCode)

Gets the analog value for a UnityEngine.KeyCode following the same logic as GameInput.GetAnalogValueForButton(GameInput.Button)
public static float GetAnalogValueForKey(this KeyCode keyCode)

Parameters

keyCode KeyCode

Returns

float
1f while a key is being held, otherwise 0f
See Also
KeyCode

GetDisplayTextForKeyCode(KeyCode)

Get the UI display text for KeyCode input using uGUI.buttonCharacters. Supports most key inputs, including controller and mouse buttons.
public static string GetDisplayTextForKeyCode(KeyCode keyCode)

Parameters

keyCode KeyCode

Returns

string

GetKeyDown(string)

Check this is the first frame a key has been pressed.
public static bool GetKeyDown(string s)

Parameters

s string

Returns

bool
True during the first frame a key has been pressed, otherwise false
See Also

GetKeyDown(KeyCode)

Check this is the first frame a key has been pressed
public static bool GetKeyDown(this KeyCode keyCode)

Parameters

keyCode KeyCode

Returns

bool
True during the first frame a key has been pressed, otherwise false
See Also
KeyCode

GetKeyHeld(string)

Check a key is currently held down
public static bool GetKeyHeld(string s)

Parameters

s string

Returns

bool
True every frame a key is held down, otherwise false
See Also

GetKeyHeld(KeyCode)

Check a key is currently held down
public static bool GetKeyHeld(this KeyCode keyCode)

Parameters

keyCode KeyCode

Returns

bool
True every frame a key is held down, otherwise false
See Also
KeyCode

GetKeyHeldTime(string)

Check how long a key has been held down
public static float GetKeyHeldTime(string s)

Parameters

s string

Returns

float
See Also

GetKeyHeldTime(KeyCode)

Check how long a key has been held down
public static float GetKeyHeldTime(this KeyCode keyCode)

Parameters

keyCode KeyCode

Returns

float
See Also
KeyCode

GetKeyUp(string)

Check this is the first frame a key has been released
public static bool GetKeyUp(string s)

Parameters

s string

Returns

bool
True during the first frame a key has been released, otherwise false
See Also

GetKeyUp(KeyCode)

Check this is the frame a key has been released
public static bool GetKeyUp(this KeyCode keyCode)

Parameters

keyCode KeyCode

Returns

bool
True during the first frame a key has been released, otherwise false
See Also
KeyCode

KeyCodeToString(KeyCode)

Turn a UnityEngine.KeyCode into a string
public static string KeyCodeToString(this KeyCode keyCode)

Parameters

keyCode KeyCode

Returns

string

StringToKeyCode(string)

Turn a string into a UnityEngine.KeyCode
public static KeyCode StringToKeyCode(string s)

Parameters

s string

Returns

KeyCode