Search Unity

  1. 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
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

TextMesh Pro Monospacing option on inspector

Discussion in 'UGUI & TextMesh Pro' started by 5argon, Aug 8, 2019.

  1. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,494
    I just discovered from the old documentation that `mspace` rich text tag is available. So any font could become monospace. It is crucial to make the scoreboard and running score looks nice. The only problem is that I didn't know about it until now.

    I wonder why there is no such checkbox on the inspector? I expect it to be available around spacing options area. So I don't have to programmatically add the tag for dynamic content like the scores.

    Screenshot 2019-08-08 02.46.14.png
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,325
    Given the number of Rich Text Tags currently available which will keep growing overtime, I am concerned adding options for these in the UI will eventually lead to too many toggles, etc...

    However, one of the new feature that will be available in the next release is the ability to assign a Style to individual text objects as seen below.

    upload_2019-8-8_0-57-59.png

    Producing the following results

    upload_2019-8-8_1-11-5.png

    This feature will enable you to define / add Styles to be applied to a whole text object.

    For a while now, users have been able to define their own styles in a Stylesheet. Thus far Stylesheets have been global and assigned in the TMP Settings. In the next release, you will also be able to assign local Stylesheets to text objects as seen above.

    The available Styles will be listed in the Style Dropdown. This will show both local and global styles available. In the event two styles have the same name then the local style will be applied. This enables overriding of global styles by local styles.

    I have also improved the nesting of styles.

    Although this functionality has been available for a while now, styles can also inject characters in the text which can be used to decorate or do things like adding a prefix or suffix to some label.

    See example 11 included in the TMP Examples & Extras.

    So although the Style option isn't the same as adding a specific option for Monospace. It should make it easier to achieve the desired result without having to manually enclose the text with the <mspace=x.xx> tag in the text itself.

    upload_2019-8-8_1-9-20.png
     
    Last edited: Aug 9, 2019
    5argon likes this.
  3. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,494
    Cool! I think that is definitely the way to go. Thanks.
     
    Stephan_B likes this.
  4. magmagma

    magmagma

    Joined:
    Oct 27, 2017
    Posts:
    24
    Hello!
    I also recently found out about this tag and it is definitely very useful. So much so that I still think it would be nice to have it as a separate toggle in the inspector, maybe as an element in the Spacing Options I guess?

    As for the Style selection dropdown, it seems it is still not available, but I'm looking forward to it!

    (on an unrelated note, would it be possible to get an answer regarding this other TMP question? Thanks in advance: https://forum.unity.com/threads/marker-underline-problems-with-fallback-fonts.732329/ )
     
  5. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,325
    This is available in the preview releases which have been available for a few months already.

    To see these packages in Package Manager, you must enable Show Preview Packages in the Advanced tab of the Package Manager UI.

    I'll take a look at that other thread and provide feedback there.
     
    magmagma likes this.
unityunity