UnityScripterAI
Discord ↗
Link Copied to Clipboard
×
"input field that you can only type english uppercase and lowercase letters"
using UnityEngine; using UnityEngine.UI; using System.Text.RegularExpressions; public class InputFieldFilter : MonoBehaviour { public InputField inputField; void Start() { inputField.onValueChanged.AddListener(delegate { FilterInput(); }); } void FilterInput() { string filteredText = Regex.Replace(inputField.text, "[^a-zA-Z]", ""); inputField.text = filteredText; } }