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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Custom Text without using plugins

Discussion in 'UGUI & TextMesh Pro' started by Bazoozoo, Oct 10, 2015.

  1. Bazoozoo

    Bazoozoo

    Joined:
    Mar 27, 2015
    Posts:
    28
    Is it possible to achieve the effect below without using plugins such as TextMeshPro etc?
     
  2. Thaao

    Thaao

    Joined:
    Jun 9, 2014
    Posts:
    54
    You could give the text shadows and outlines using UI effects, and then put a gradient/pattern on top of it (exactly how to make something render like a 'clipping layer' in Unity right now I can't remember, but it is possible... I need to look it up again because I need to use the idea for a 'battery life' symbol in my current project. But there's some way you can make it so that something only renders on top of where it overlaps something else, so you'd just have the gradient as one big rectangle over all the text, but set so that only the part that overlaps the text will render, if that makes sense. The text itself would be white).

    if you're only going to do something using a few characters, like numbers, for example, you could just make sprites of the numbers and display them in your own way. For example, I had a game with a combo counter similar to the '8 hits' in the image you posted. I just had sprites for each of the 10 digits, and a script that managed which to display by calculating the number that needed to be displayed and calling the digits for each place. The "hits" itself would just be a sprite, too. Of course, if you're making a lot more than just a few, it's probably better to use something else. I only needed the combo counter, and there was no additional text, so just having to make 10 sprites was not hard.

    There are quite a few ways you can accomplish it; don't feel like each character's finished appearance has to be a part of a font and you'll find lots of creative ways to handle this kind of thing.
     
  3. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The Outline and Shadow effects in Unity 5.2 are very inefficient in terms of performance and increased geometry requirements. Here is a link to a previous post of mine comparing the performance of the two. Basically, the way TextMesh Pro handles Outline and Shadow is substantially more efficient (over 10X).

    Adding a vertex color gradient or texture on the face or outline of the text would have no real performance impact over these numbers.
     
    Last edited: Oct 10, 2015