Table of Contents

Class CustomKeyCode

A class to supersede Unity's KeyCode enum to allow keycodes to refer to multiple keys - e.g. Shift instead of separated into LeftShift and RightShift.

public class CustomKeyCode : IEnumerable
Inheritance
CustomKeyCode
Implements
Inherited Members

Fields

Alt

public static readonly CustomKeyCode Alt

Field Value

CustomKeyCode

Ctrl

public static readonly CustomKeyCode Ctrl

Field Value

CustomKeyCode

GreaterThan

public static readonly CustomKeyCode GreaterThan

Field Value

CustomKeyCode

LessThan

public static readonly CustomKeyCode LessThan

Field Value

CustomKeyCode

Minus

public static readonly CustomKeyCode Minus

Field Value

CustomKeyCode

Plus

public static readonly CustomKeyCode Plus

Field Value

CustomKeyCode

Shift

public static readonly CustomKeyCode Shift

Field Value

CustomKeyCode

_0

The keycode for 0.

public static readonly CustomKeyCode _0

Field Value

CustomKeyCode

_1

The keycode for 1.

public static readonly CustomKeyCode _1

Field Value

CustomKeyCode

_2

The keycode for 2.

public static readonly CustomKeyCode _2

Field Value

CustomKeyCode

_3

The keycode for 3.

public static readonly CustomKeyCode _3

Field Value

CustomKeyCode

_4

The keycode for 4.

public static readonly CustomKeyCode _4

Field Value

CustomKeyCode

_5

The keycode for 5.

public static readonly CustomKeyCode _5

Field Value

CustomKeyCode

_6

The keycode for 6.

public static readonly CustomKeyCode _6

Field Value

CustomKeyCode

_7

The keycode for 7.

public static readonly CustomKeyCode _7

Field Value

CustomKeyCode

_8

The keycode for 8.

public static readonly CustomKeyCode _8

Field Value

CustomKeyCode

_9

The keycode for 9.

public static readonly CustomKeyCode _9

Field Value

CustomKeyCode

allKeyCodes

All Unity KeyCodes and all combined keycodes.

public static readonly CustomKeyCode[] allKeyCodes

Field Value

CustomKeyCode[]

alphabet

The keycodes A-Z.

public static readonly CustomKeyCode[] alphabet

Field Value

CustomKeyCode[]

combinedKeyCodes

All the defined keycodes that combine multiple Unity KeyCodes.

public static readonly CustomKeyCode[] combinedKeyCodes

Field Value

CustomKeyCode[]

digits

The keycodes 0-9.

public static readonly CustomKeyCode[] digits

Field Value

CustomKeyCode[]

Properties

displayName

What will be returned from ToString().

public string displayName { get; }

Property Value

string

keyCodes

The Unity KeyCodes comprising this keycode.

public List<KeyCode> keyCodes { get; }

Property Value

List<KeyCode>

Methods

Contains(KeyCode)

Returns true if the Unity KeyCode forms part of this CustomKeyCode.

public bool Contains(KeyCode keyCode)

Parameters

keyCode KeyCode

Returns

bool

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

FromString(string)

Converts a string into the keycode with that display name. Returns null if there isn't one.

public static CustomKeyCode FromString(string displayName)

Parameters

displayName string

Returns

CustomKeyCode

GetEnumerator()

Returns an enumerator that iterates through a collection.

public IEnumerator GetEnumerator()

Returns

IEnumerator

An IEnumerator object that can be used to iterate through the collection.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetKey()

Returns true while this key is being held down.

public bool GetKey()

Returns

bool

GetKeyDown()

Returns true the frame this key is pressed.

public bool GetKeyDown()

Returns

bool

GetKeyUp()

Returns true the frame this key is released.

public bool GetKeyUp()

Returns

bool

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

operator ==(CustomKeyCode, CustomKeyCode)

public static bool operator ==(CustomKeyCode keyCode1, CustomKeyCode keyCode2)

Parameters

keyCode1 CustomKeyCode
keyCode2 CustomKeyCode

Returns

bool

implicit operator CustomKeyCode(KeyCode)

public static implicit operator CustomKeyCode(KeyCode keyCode)

Parameters

keyCode KeyCode

Returns

CustomKeyCode

operator !=(CustomKeyCode, CustomKeyCode)

public static bool operator !=(CustomKeyCode keyCode1, CustomKeyCode keyCode2)

Parameters

keyCode1 CustomKeyCode
keyCode2 CustomKeyCode

Returns

bool