Skip to content

Support Input System in KeyIsPressedUnit#405

Merged
oco777 merged 1 commit intomainfrom
codex/fix-keyispressedunit-for-new-input-system
Dec 13, 2025
Merged

Support Input System in KeyIsPressedUnit#405
oco777 merged 1 commit intomainfrom
codex/fix-keyispressedunit-for-new-input-system

Conversation

@oco777
Copy link
Copy Markdown
Owner

@oco777 oco777 commented Dec 13, 2025

Summary

  • add Input System handling for KeyIsPressedUnit with keyboard null checks and key mapping
  • retain legacy UnityEngine.Input.GetKey fallback when the Input System is disabled
  • document the dual input handling for the key pressed Scratch unit

Testing

  • not run (not available in this environment)

Codex Task

@oco777 oco777 merged commit 4b7e43f into main Dec 13, 2025
3 checks passed
@oco777 oco777 deleted the codex/fix-keyispressedunit-for-new-input-system branch December 13, 2025 05:16
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +105 to +109
if (keyCode >= KeyCode.Alpha0 && keyCode <= KeyCode.Alpha9)
{
inputSystemKey = (Key)((int)Key.Digit0 + ((int)keyCode - (int)KeyCode.Alpha0));
return true;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fix Input System mapping for numeric keys

In the Input System path, numeric keycodes are converted via Key.Digit0 + offset, but Unity’s Key enum follows HID usage codes where Digit1Digit9 precede Digit0 (Digit0 is 39, Digit1 is 30, etc.). As a result, when ENABLE_INPUT_SYSTEM is defined, pressing 19 (and the keypad digits just below this block) resolves to Keyboard.current[Key.Enter/Escape/…] instead of the digit controls, so KeyIsPressedUnit reports false for those numbers even though they’re held. Only 0 maps correctly. Please map each digit explicitly (or base off Key.Digit1 with a special case for 0) so numeric keys work under the Input System.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant