Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    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

    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?