I was wondering if there is a way to display Emojis in a text using its HTML code (for example, bicycleEmojiCode string is the bicycle emoji in HTML). All I’ve found uses unicode or other code rather than HTML. This is the code I’m using right now:
🚴 is not an HTML “code”. It’s actual a SGML / XML / HTML entity reference. Such an entity generally has the form of &XXXX; where XXXX represents the entity name. The special character # denotes a unicode character and the following numbers are simply the decimal unicode code point for the character. Instead of a decimal code point it’s usually more common to use hexadecimal code points. For this you generally use &#xHHHH; in XML / HTML where HHHH is a hexadecimal number.
Of course HTML or anything related to HTML is completely irrelevant in Unity. If your used font actually supports your wanted code points you can simply use those unicode characters directly inside your code by using the proper C# unicode escape sequences. In C# you can only specify hexadecimal unicode code points. There are two ways. Either \uXXXX or \UXXXXXXXX Note that when using \u you always have to give exactly 4 hex digits when using \U you have to specify exactly 8 digits. So \u can only be used for the code points 0000 to FFFF.
The code point in question () is beyond the four digits so you have to use \U. The decimal number “128692” is “1F6B4” in hexadecimal. Since we need 8 digits we have to add 3 padding zeros: