Enum InputField.CharacterValidation
The type of characters that are allowed to be added to the string.
Namespace: UnityEngine.UI
Syntax
public enum CharacterValidation
Remarks
Note that the character validation does not validate the entire string as being valid or not. It only does validation on a per-character level, resulting in the typed character either being added to the string or not
Fields
Name | Description | Value |
---|---|---|
None | No validation. Any input is valid. |
0 |
Integer | Allow whole numbers (positive or negative). Characters 0-9 and - (dash / minus sign) are allowed. The dash is only allowed as the first character. |
1 |
Decimal | Allows decimal numbers (positive or negative). Characters 0-9, . (dot), and - (dash / minus sign) are allowed. The dash is only allowed as the first character. Only one dot in the string is allowed. |
2 |
Alphanumeric | Allows letters A-Z, a-z and numbers 0-9. |
3 |
Name | Only allow names and enforces capitalization. Allows letters, spaces, and ' (apostrophe). A character after a space is automatically made upper case. A character not after a space is automatically made lowercase. A character after an apostrophe can be either upper or lower case. Only one apostrophe in the string is allowed. More than one space in a row is not allowed. A characters is considered a letter if it is categorized as a Unicode letter, as implemented by the Char.Isletter method in .Net. |
4 |
EmailAddress | Allows the characters that are allowed in an email address. Allows characters A-Z, a.z, 0-9, @, . (dot), !, #, $, %, &, ', *, +, -, /, =, ?, ^, _, `, {, |, }, and ~. Only one @ is allowed in the string and more than one dot in a row are not allowed. Note that the character validation does not validate the entire string as being a valid email address since it only does validation on a per-character level, resulting in the typed character either being added to the string or not. |
5 |