Skip to content

Feature Request: Add TMP-based OTP/PIN Input Field Control #519

@GID0317

Description

@GID0317

Unity UI Extensions Feature Request

Is your feature request related to a problem? Please describe

Unity UI Extensions currently does not seem to have a dedicated OTP/PIN input field, where one input is displayed as separate visual slots like:

[ ] [ ] [ ] [ ] [ ] [ ]

This is a common UI pattern for verification codes, PIN screens, access codes, parental gates, and similar flows.

The usual workaround is to use multiple TMP_InputField objects, one for each digit. However, that approach can become awkward because focus handling, backspace behavior, paste support, mobile keyboard behavior, and completion detection all need to be managed manually.

How would you classify your suggestion

  • Usability / Configuration

Describe the solution you'd like

I would like to suggest adding a reusable OTPInputField component for TextMeshPro-based Unity UI.

The idea is to use one real TMP_InputField as the actual input source, then display each digit through separate visual TMP_Text slots. This keeps the input behavior simple while still allowing the UI to look like a normal OTP/PIN field.

The component could support configurable code length, numeric-only input, paste handling, optional digit masking, value changed events, and a completion event when the required number of digits has been entered.

The visual styling should stay flexible. The component should not force a specific slot design, border, animation, or layout. It only needs to manage the input value and update the assigned digit slot texts.

Example:
text
PINInput TMP_InputField + OTP/PINInputField.cs
└── Slots
├── Slot1 TMP_Text
├── Slot2 TMP_Text
├── Slot3 TMP_Text
├── Slot4 TMP_Text
├── Slot5 TMP_Text
└── Slot6 TMP_Text

Describe alternatives you've considered

The main alternative is using multiple TMP_InputField components. I tried to avoid this because it makes the control more fragile. Each field would need custom focus movement, deletion logic, paste distribution, and completion checking.

Another alternative is to let each project create its own OTP/PIN input field, but this is a common enough UI pattern that it may make sense as a reusable Unity UI Extensions control.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions