if (m_inputField == null) { LogUtils.LogError("[m_inputField] can't find:" + this.gameObject.name); } else { m_inputField.onValidateInput += (_text, _index, _addedChar) => { // Filter out the Unicode categories you want (example below), // keep in mind that, while this can filter out Emojis, // it can also filter out chars you might want to keep // (e.g. Asiatic languages, which I don't need to care about right now), // so this is not a perfect solution. var _unicodeCategory = char.GetUnicodeCategory(_addedChar);
switch (_unicodeCategory) { case UnicodeCategory.OtherSymbol: case UnicodeCategory.Surrogate: case UnicodeCategory.ModifierSymbol: case UnicodeCategory.NonSpacingMark: { returnchar.MinValue; } default: { return _addedChar; } } }; } } }