Skip to content

TMP_InputField Regex character validation causes enum parse exception in WebGLInput wrapper #185

@GaryGardinerArthrex

Description

@GaryGardinerArthrex

Description:
When using a TMP_InputField with ContentType set to Custom and characterValidation set to Regex, the WebGLInput wrapper attempts to map the TMP enum value to the standard InputField.CharacterValidation enum. Since Regex is not defined in the standard enum, this results in a System.ArgumentException:

Requested value 'Regex' was not found.

Steps to Reproduce:

  1. Create a TMP_InputField in Unity.
  2. Set ContentType to Custom.
  3. Set characterValidation to Regex.
  4. Attempt to set the input field value via the WebGLInput wrapper.

Expected Behavior:
Setting the value should not throw an exception.

Actual Behavior:
An exception is thrown due to an unsupported enum value mapping.

Suggested Fix:
Add a check to ensure only supported enum values are mapped, and fallback to a default value (e.g., None) for unsupported values like Regex.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions