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.

Question Using One-Off Sprites + Atlas in TextMeshPro

Discussion in 'UGUI & TextMesh Pro' started by Mhin-Ra, Mar 3, 2023.

  1. Mhin-Ra


    Mar 29, 2015
    I've got a standard sprite atlas I'm using for most of my text icons. However, in some cases, I would like to include one off images into text runs. I'm basically trying to do something like an <img> tag from HTML inline with my text, a la:
    So, imagine in the above example the smiley faces come from my atlas and the cat is just a freestanding sprite.

    I want to do this b/c the game has a bunch of text conversations which should have inline images. It would be awkward to have to insert every image that might occur in any conversation into my text glyph atlas, both from an authoring point of view and because the inline images will all be random sizes. However, I still want all my conversations to have access to the 'standard' glyphs (for my game) from my atlas, a la:

    I read a post by Stephan that seemed to suggest you could directly reference a standalone sprite with a tag like <sprite="wreckedShip">, where wreckedShip is:

    Although he cautioned that this would incur an extra draw call. For big, relatively rare images, that cost seems acceptable. But I've not managed to get it to actually work.

    Am I barking up the crazy tree or can this be done? And if so, would it be possible to get a step by step on how to set it up b/c I seem to be missing some part of the workflow?