Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

mpartel

4
Posts
1
Topics
2
Following
A member registered Aug 03, 2021

Recent community posts

(2 edits)

Nice! Ok, that regex is truly horrifying, but if it works ¯\(ツ)

I’ve not read the code in detail, but I wonder if the regex could be built dynamically from the set of available PNGs. Basically something like string.Join('|', imageNames.OrderByDescending(n => n.Length).Select(HexToRegex).ToArray())

I’m not sure exactly what causes the crash, but I think you might want to replace all surrogate chars. They should come in high+low pairs, but there could be strays and other combinations in malicious input.

Could the licensing issue could be solved by linking to an emoji pack and supporting whatever download they have with as little friction as possible 🤔

Oh, not supporting emojis is understandable. I think it still shouldn’t crash like that, and it’d be nice if it rendered unsupported characters (even when composed of surrogates) as “<?>” or something.

I already happily use quads for non-user-defined text, and I’m working on restricting/filtering user-defined text now. It’s a little unfortunate to have to ban all emojis from usernames and in-game chat. Even only supporting the most common emojis, and an API for querying whether a given string is fully supported, would IMO be quite useful.

If I add a smiley like https://www.fileformat.info/info/unicode/char/1f601/index.htm to a SuperTextMesh, I get the following

Error: UTF-16 to UTF-8 conversion failed because the input string is invalid
UnityEngine.StackTraceUtility:ExtractStackTrace ()
SuperTextMesh:FigureOutUnwrappedLimits (UnityEngine.Vector3) (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:2951)
SuperTextMesh:RebuildTextInfo () (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:3239)
SuperTextMesh:Rebuild (single,bool,bool) (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:1572)
SuperTextMesh:Rebuild (single,bool) (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:1521)
SuperTextMesh:Rebuild () (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:1511)
SuperTextMesh:set_text (string) (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:774)
EmojiTest:<Start>b__2_0 () (at Assets/EmojiTest.cs:10)
UnityEngine.EventSystems.EventSystem:Update ()

and

Error: UTF-16 to UTF-8 conversion failed because the input string is invalid
UnityEngine.StackTraceUtility:ExtractStackTrace ()
SuperTextMesh:RebuildTextInfo () (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:3289)
SuperTextMesh:Rebuild (single,bool,bool) (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:1572)
SuperTextMesh:Rebuild (single,bool) (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:1521)
SuperTextMesh:Rebuild () (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:1511)
SuperTextMesh:set_text (string) (at Assets/Clavian/SuperTextMesh/Scripts/SuperTextMesh.cs:774)
EmojiTest:<Start>b__2_0 () (at Assets/EmojiTest.cs:10)
UnityEngine.EventSystems.EventSystem:Update ()

If I do the same in an IL2CPP build, it segfaults in some C++ code that tries to convert utf16 to utf8.

This is especially problematic when the text is user-defined.