Search Unity

Question Converting TMP_FontAsset.HasCharacters missing chars array back into a string

Discussion in 'UGUI & TextMesh Pro' started by ChickensAreDinosaurs, Mar 24, 2023.

  1. ChickensAreDinosaurs

    ChickensAreDinosaurs

    Joined:
    May 11, 2021
    Posts:
    17
    Hey all,

    I am trying to use TMP_FontAsset.HasCharacters to identify missing chars for in-game debug purposes with localized text and fonts.

    This function has an out uint[] parameter that returns the chars missing from the font asset, but the issue is that when e.g. the duck emoji is processed by this function, the missing chars array will contain two chars instead of one (I understand that these can require varying numbers of bytes).

    I want to use this array of missing chars to convert back into a string for logging purposes, but as far as I'm aware, there is no way for me to know when this has occurred so I can process the bytes correctly. Is there a nice way to do this properly?