Search Unity

Unity Emojis Keep Showing Up For Certain Unicodes

Discussion in 'UGUI & TextMesh Pro' started by habitoti, Apr 12, 2019.

  1. habitoti

    habitoti

    Joined:
    Feb 28, 2013
    Posts:
    141
    Hi,

    I have my own sprites for certain Unicode characters, and I essentially don't want any of the default Unity "fat" Emojis that are delivered as default show up at any time. I've set the fallback sprite asset to "None", and there are no specific Unicode chars defined anyway in the default spritesheet (all set to zero).
    However, when entering some unicodes from a text input that I haven't covered so far, it still falls back to to Unity Emojis, and it is unclear to me on what basis. Sometimes I even get the first third of the Unity logo that stretches over three slots. Is that a bug, or am I still missing some secret setting to prevent them? As nice and funny as they are, they just mess up my usecase.
    Using 2018.3.11f

    Thanks, Habitoti
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    If I understand correctly, you have your own Sprite Asset that contains the Emojis you wish to use. Correct?

    You have assigned unicode values to your Emojis / sprites. Correct?

    Lastly since you want to use your own Sprite Asset instead of the Default one, you have assigned and replace the default Sprite Asset by your own in the TMP Settings. Correct?

    upload_2019-4-12_0-1-28.png

    Also make sure you place your sprite asset in the appropriate location which is defined in the TMP Settings as well which by default is "Resources/Sprite Assets/..."
     
  3. habitoti

    habitoti

    Joined:
    Feb 28, 2013
    Posts:
    141
    Sorry, for some reason the forum did not inform me about an answer here...
    All of your statements above ("Correct"?) are correct, yes ;-)
    Seems like I actually missed the TMP Settings fallback, which was still on the standard Emoji asset. I think the multiple levels of fallback chains are really a bit confusing. I thought I comprehensively defined the desired fallback chain through the settings of the actually used text component. That this -- even with explicit local overrides -- is still falling back through some default settings elsewhere is IMHO error prone. That fallback should only catch if I have no other local explicit fallback, or I would at least need an explicit "stop" in the fallback chain to prevent falling back to some other global setting.
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The fallback search chain is comprehensive in order to provide users with the functionality they need / have requested. It may appear complex but it is pretty straightforward once you know how it searches.

    When a character is requested (Unicode), TMP will (1) first search the primary font asset (the one assigned to the text object).

    (2) Then search through the list of fallbacks assigned to this primary font asset starting with the first on the list / recursively through any of its fallbacks before moving to the second / next fallback.

    (3) Check if a sprite asset is assigned to the text object and search for any sprite using this Unicode value. It will also search any potential fallback sprite assets assigned to this local sprite asset.

    (4) Search the general Fallbacks in the TMP Settings and recursively through their own potential fallbacks.

    (5) Search the default sprite asset assigned in the TMP Settings and recursively through all of their own potential fallbacks.

    (6) The default font asset assigned in the TMP Settings and recursively through its potential fallbacks.

    (7) Lastly display the missing glyph assigned in the TMP Settings.
     
  5. habitoti

    habitoti

    Joined:
    Feb 28, 2013
    Posts:
    141
    Yeah, you're right. Now that I know all the places it's easier ;-)
    I was just confused when those Emojis kept showing up where I wouldn't have expected them given the fallbacks I provided myself.