Search Unity

TextMeshPro UGUIText Sprite support issue

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by Zeit, Mar 17, 2017.

  1. Zeit

    Zeit

    Joined:
    Aug 22, 2014
    Posts:
    17
    Not sure if this error comes from my configuration or its something on TMP side.

    I'm trying to set up emoji support for my chat system. Here's the sprite asset



    (As I couldnt find any documentation for what the unicode value should be I tried all possible combinations )

    Then I set up my text component with this script

    Code (CSharp):
    1.     void Start () {
    2.         GetComponent<TMPro.TextMeshProUGUI>().SetText("<sprite=1> \U0001F60D");
    3.     }
    And I get this result



    Does anyone have a clue of what can be happening or can point me towards this piece of documentation as I haven't been able to find it?

    Thanks
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,614
    Although I have made additional improvements / changes to some of this, the following video should prove useful in terms of the Sprite Asset Creation process and the use of the Sprite tag.



    With respect to the specific sprite not showing up based on the use of the UTF32 unicode, I am looking into it right now. I'll provide an update as soon as I have more info.

    Code (csharp):
    1.  
    2. private void Start()
    3. {
    4.     m_TextComponent.SetText("<sprite=1> \U0001F60D");
    5. }
    6.  
    The code above works fine for me. Make sure the Default Sprite Asset assigned in your TMP Settings file is the one with those Emojis you are trying to use.
     
    Last edited: Mar 17, 2017
  3. Zeit

    Zeit

    Joined:
    Aug 22, 2014
    Posts:
    17
    Hi Stephan,

    I was only setting the Sprite Asset in the TextMeshProUGUI component as I was unaware of the settings file (Maybe the menu under Window->TMP could have a reference to it to make it easier to find). Thankfully I set that up and it worked.

    Thanks!
     
  4. Zeit

    Zeit

    Joined:
    Aug 22, 2014
    Posts:
    17
    One more thing, not sure if its a bug or some layout limitation.

    If you have a text like:
    The automatic layout only resizes to the last text before a non escaped emoji (In this case, the layout only covers Text1 ,Text2 and \u2600)

    I'm trying to make a bubble chat with a vertical layout but it wont work as the icons and the text after it dont resize the text transform. As a workaround the icons can be escaped, although this might not be the most easy way
     
    Last edited: Mar 20, 2017
  5. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,614
    I did fix an issue related to this where if the sprite was the last character, we would get incorrect preferred width and height which is what the layout components rely on to determine the size. There was also an issue where it would not update correctly based on some changes which was also addressed.

    These fixes will be in the next release.
     
  6. Zeit

    Zeit

    Joined:
    Aug 22, 2014
    Posts:
    17
    Hi @Stephan_B ,

    I've just updated to the latest release (Mar 31) and the automatic layout size issue remains



    When using a content size fitter the layout adjust fine until there's a full line that is solely made with emoticons, after that it just stops resizing.

    Another issue I've found is that previously I was able to use

    and worked, now it just shows me blank squares although I have the same configuration as before and double checked my sprite asset/test asset/text object just to be sure, did that funcionality got removed or changed?

    Thanks
     
  7. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,614
    I am in Iceland right now with limited access but will be back this weekend. If you can provide me with a Repro (via email) I can take a look at these once I am back.
     
unityunity