keyHitCountSinceLastFrame method
- KeyCodes key
Gets the number of times a specific key
was pressed (hit) during the current frame.
This can be greater than 1 if the key was pressed multiple times rapidly within the same frame (e.g., due to browser key repeat or very fast tapping).
key
: The KeyCodes value to check.
Returns the number of times the key
was hit in this frame.
Returns 0
if key
is KeyCodes.Unknown.
Implementation
int keyHitCountSinceLastFrame(KeyCodes key) {
return (key == KeyCodes.Unknown) ? 0 : _keyHit[key] ?? 0;
}