unity输入屏蔽emoji
安卓的emoji显示乱码,IOS没事,在input监听屏蔽即可 onValidateInput
/// <summary> /// 输入框屏蔽emoji /// </summary> private readonly string[] pattens = {@"\p{Cs}", @"\p{Co}", @"\p{Cn}", @"[\u2702-\u27B0]"}; private char InputValueChange(string text, int charIndex, char addedChar) { if (pattens.Length > 0) { string str = $"{addedChar}"; if (IsEmoji(str)) { return '\0'; } } return addedChar; } private bool IsEmoji(string s) { for (int i = 0; i < pattens.Length; ++i) { if (Regex.IsMatch(s, pattens[i])) { return true; } } return false; }