I want to use Emoji's in my game But currently unity is not Supporting all Emoji's. So, I decided to Find out that which Emoji is pressed from keyboard, or I can get the Unicode of the Emoji's pressed by keyboard. Is there any way to find that out.
Asked
Active
Viewed 42 times
1 Answers
0
If you want to use emojis (probably in InputField
), you first have to download font that supports emojis. You can also get a binary or unicode representation of character. Unity doesn't catch emojis with Input.GetKeyDown
, so I suppose you want to do it with InputField
. This is how you can do it:
using TMPro;
using System;
using UnityEngine;
public class Test : MonoBehaviour
{
[SerializeField] private TMP_InputField inputField;
private void Start()
{
inputField.onValidateInput += OnValidateInput;
}
private char OnValidateInput(string text, int index, char c)
{
print(@$"
binary: {Convert.ToString(c, 2)};
unicode: {"\\u" + ((int)c).ToString("X4")};
");
return c;
}
}
We just serialize TMP_InputField
, where we see what character was written in OnValidateInput
event. I hope that helps you!

IDBB
- 60
- 7
-
this is Not working properly not showing the Unicode of the Emoji when emoji is Entered. – Rahmat Ali Aug 01 '23 at 06:49
-
It won't show you emoji's unicode if your font doesn't have this emoji. You have to use a font that contains desirable emoji. – IDBB Aug 01 '23 at 11:40