Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

TextMesh Pro Text Mesh Pro does not work with spriteatlas assets.

Discussion in 'UGUI & TextMesh Pro' started by sidespin, Jun 18, 2019.

  1. sidespin

    sidespin

    Joined:
    Jun 22, 2018
    Posts:
    20
    When I try to create a Text Mesh Pro Sprite Assets it says "A texture which contains sprites must first be selected in order to create a TextMesh Pro Sprite Asset."

    What's the proper way to use the spriteatlas file I already have?
     
    Laicasaane likes this.
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,237
    The Atlas Texture must first be set to Sprite Mode and you also need to define those sprites in the Sprite Editor.

    Once the above has been done, you can then create the sprite asset.

    The following video is a bit old but most of its content is still applicable.
     
  3. sidespin

    sidespin

    Joined:
    Jun 22, 2018
    Posts:
    20
    Hi Stephan, thanks for replying. Actually I was referring to the new Sprite Packer which allows the use of .spriteatlas asset (references a folder and pack them behind the scene). TMP does not seem to work with this type of asset. Instead, I'll have to create a Multi-Sprite asset. This is a burden on the pipeline. Because every I add a new icon to the sprite it requires

    1. specify sprites source files to be packed
    2. create the spritesheet atlas texture/metadata using 3rd party software
    3. import it to Unity as Multi-Sprite and preserve the atlas information
    4. create/update the TMP Sprite Asset

    Is there any plan to support the new .spriteatlas format?
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,237
    I would love to support the sprite atlas system. It is simply a matter of time / priorities. So much to do and so little time.

    P.S. In release 1.4.x and 2.0.x of TMP with Dynamic SDF support, the structure of Sprite Asset has changed to include a Sprite Character Table and Sprite Glyph Table. The Sprite Glyphs now include the Glyph Rect which corresponds to the UV coordinate of the sprite in the texture. This is the part that needs to get updated based on where the sprite atlas system placed the sprite glyph. In addition, we need to make sure we point to the correct texture as there could be more than one but this is something TMP already knows how to handle with font assets. All this to say, this could be implemented.
     
    Laicasaane likes this.
  5. Laicasaane

    Laicasaane

    Joined:
    Apr 15, 2015
    Posts:
    69
    Suddenly our project also in need of this feature. We have a bunch of small sprites and just want to use Unity Sprite Atlas to pack them then create TMP Sprite Asset out of that atlas. We just don't want to use another tool to create and maintain a spritesheet.
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,237
    I did explore adding support for the Unity Sprite Atlas but some functionality is not available yet. I am having discussions with the 2D Team but don't have an ETA from them as to when / if the required functionality will be added.

    The main issue is the Sprite Atlas pointing to the individual sprites in the Editor and to the atlas in playmode. The desired behavior is once packed, they should always point to their combined atlas. In addition, retrieving sprites results in allocations of clones of the sprites which is an issue as we want a reference to the actual source sprites.

    Hopefully, the 2D Team can add the required functionality for this to be supported.

    In the meantime, I understand the desire to not use an external tool but that is the only solution at this time.
     
    Laicasaane likes this.
  7. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    924
    That would be really awesome because as it stands every time I have a new icon, I must recreate an entire sprite sheet with a 3rd party program and that takes time. Really looking forward to this feature!
     
  8. DimaHubenkoGamepoint

    DimaHubenkoGamepoint

    Joined:
    May 16, 2018
    Posts:
    20
    Bump, really needed feature. Also I'd like to say that we are interested in "animated sprites" in text - for example animated smiles. By now the only solution I see is to replace image in atlas by timer, but that requires SubMesh regeneration. This animated feature is needed only for same size sprites, so regeneration can be skipped...
    Is there any better proposition?
     
  9. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,237
    As per my previous post, adding support for the Sprite Atlas system would most certainly add value and something that I will be adding at some point. My challenge is simply too many things to do with so little time.

    With regards to animated sprites, this can be achieved using the <sprite> tag with anim attribute as seen in this example / post.
     
  10. Michal_Stangel

    Michal_Stangel

    Joined:
    Apr 17, 2017
    Posts:
    77
    Bump. Just migrated to Unity's Sprite Atlas system and realized that it cannot be used for TMP's sprite displaying.
     
  11. MaxGuernseyIII

    MaxGuernseyIII

    Joined:
    Aug 23, 2015
    Posts:
    314
    Yeah. I'm having a hard time figuring out how to use TMP in its current state. Everything I've seen shows me how to use a giant texture instead of what I have, which is one texture per image. Converting the many-loose textures into the consolidated mega-texture required by TMP seems time-consuming an error-prone. It seems like the cheapest course of action must be to write a build-time script that automatically generates one of these multi-sprite textures for the purpose of TMP every build. Is there a better option?
     
  12. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    5,237
    Until I get around / find the time to add support for the Sprite Atlas system, you can use an external tool like TexturePacker.

    TexturePacker makes it easy to take several separate images and to pack them into a single texture.

    To work with the TMP Sprite importer (Window - TextMeshPro - Sprite Importer), you have to use the JSON Array export option (included in the free version of TexturePacker). This produces a texture + data file (.json) that you will use to create the sprite asset.

    There should be several threads on the forum about using the Sprite Importer. Here is one such thread where some issue was reported which has now been resolved but the thread still contains useful information.
     
  13. MaxGuernseyIII

    MaxGuernseyIII

    Joined:
    Aug 23, 2015
    Posts:
    314
    Understandable. We all have to work to priority.

    I found a tool that helped along those lines (Simple Sprite Packer). It was not too hard to use. I forgot to update this thread.
     
    pixelR and FeastSC2 like this.
  14. pixelR

    pixelR

    Joined:
    Sep 16, 2013
    Posts:
    52
    Gosh, I also didn't expect that Sprite Atlas cannot be used for text sprites and that we have to maintain a sprite sheet separately, without any built-in tool available. :/ So yeah, I'd like to bump the feature request of supporting sprite atlas files.

    Edit: I'll give Simple Sprite Packer a go, thanks for the hint, @MaxGuernseyIII
     
  15. Kleptine

    Kleptine

    Joined:
    Dec 23, 2013
    Posts:
    112
    Yeah this is brutal.
     
  16. arcnor

    arcnor

    Joined:
    Nov 29, 2014
    Posts:
    14
    Suddenly found myself today in need of this, so adding my voice here (given that I cannot find a proper issue to vote / watch)
     
unityunity