Search Unity

TextMesh Pro Monospacing option on inspector

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by 5argon, Aug 8, 2019.

  1. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,265
    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:
    3,312
    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,265
    Cool! I think that is definitely the way to go. Thanks.
     
    Stephan_B likes this.