Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question TextMeshPro - Proper way of adding text shadow(lower border)

Discussion in 'UGUI & TextMesh Pro' started by qLate, Nov 16, 2023.

  1. qLate


    May 3, 2019
    In my current project, most of the text is displayed with shadow:

    I achieved this effect by spawning the same text, but with darker color and offset and it works.

    However it's obvious that this approach is bad for performance, especially for my project, where a lot of text objects are being spawned and destroyed constantly. And it's a bit annoying, because instead of just a regular TMPro component there's now a gameobject with custom script and 2 children -- main text and border text.

    I've already looked into some of the TMPro features, such as underlay, but there's a problem. The border is created of a single color, while I need it to have a bit darker color then the symbol which it was created for.

    Here's an example of text with color tags and underlay enabled:

    Therefore I've been looking for a better solution -- maybe a shader, or some kind of vertex manipulations to achieve similar effect without the need of instantiating new objects.
    Last edited: Nov 16, 2023