Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

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


    May 11, 2021
    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?