Search Unity

Text Mesh Pro - The Ultimate Text Solution for Unity - Powerful & Flexible - Advanced Text Rendering

Discussion in 'Assets and Asset Store' started by Stephan-B, May 29, 2014.

Thread Status:
Not open for further replies.
  1. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    It is especially useful when using the text auto-sizing feature that will be part of the next release of TextMesh Pro.
     
  2. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    New TextContainer Component, Margins and Masking
    As I mentioned before, the new TextContainer Component which will be in the new release of Text Mesh Pro will make several new features possible since the text will now exist in a defined region as opposed to being just a point in space.

    One of those features will be Masking (Soft & Hard). Masking of the text will occur whenever the text is outside the margin area or outside the Text Container.


    Animated GIF showing the new TextContainer Component, Margins and Masking.
     
  3. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Just a follow up to previous post. In this example, the Margin and Character Spacing is controlled via Unity's Animation Editor.

     
  4. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Text Auto-Sizing, Word Wrapping & Forced Line Feed
    This short video is in response to a user who was curious about how all these features would interact with each other. This is not my most entertaining video or visually stimulating but nonetheless it answers the user's question :)

     
    iYalovoi likes this.
  5. Nikola-B

    Nikola-B

    Joined:
    Jan 31, 2014
    Posts:
    42
    Can the Softness of the Mask be controlled?
     
  6. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Yes. You can control the softness for both horizontal and vertical axis.
     
  7. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Quick update: I am currently working on a text input component which will enable taking user input at run-time. I am curious about how many of you might be interested or needing this feature?
     
    Last edited: Jul 17, 2014
  8. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    TMPro - Text Input Component
    Here is a preview of the new Text Input Component for TextMesh Pro which will allows users to input or edit text at Run-time in the Gameview window.

     
    iYalovoi and User340 like this.
  9. iYalovoi

    iYalovoi

    Joined:
    Jun 20, 2013
    Posts:
    2
    Amazing and brilliant. Any idea when it will be released? I would really enjoy to have text container!
     
  10. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I would like to get the Text Input Component out with the next release which is 0.1.45 but it might have to wait until the next one which would be perhaps 2 weeks later.

    The Text Container is scheduled for the next release (0.1.45) which I am trying to finished. Again, hoping to get this out within the next 7 days. Although it is beta, I still would like it to be solid since that a pretty big change which also needs to play nice with the Text Input Component.
     
  11. Nikola-B

    Nikola-B

    Joined:
    Jan 31, 2014
    Posts:
    42
    That looks great :)
     
  12. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Thanks!
     
  13. Torninator

    Torninator

    Joined:
    Jun 17, 2014
    Posts:
    11
    Hello,

    I've just purchased this script to do rendering in the 2D game i'm making. I'm having a hard time getting it working with an orthographic camera using Unity's 2D features.

    I'm using the new Unity 2D 'Sorting Layers' and 'Sorting Order' rendering settings for my sprites - which works fine, however the Text Mesh appears behind the sprites.

    So, I've googled solutions for this and have found the following script to expose Sorting Layer Name and Sorting Order on the Mesh Renderer: http://feedback.unity3d.com/suggest...ingorder-properties-on-non-sprite-gameobjects

    This works fine in the scene view, however as soon as I hit play, it seems the Mesh Renderer attached to the TextMeshPro object loses the sorting layer and sorting order information.

    Can these properties please be exposed by TextMeshPro? And/or not altered if they are already set?

    Or, can you suggest anything different I can do?

    Thanks!
     
  14. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    If you open the "Extra Settings" panel of the TextMesh Pro object, you will see the "Orthographic Mode" which you should enabled to ensure proper scaling since Unity uses different scale in Ortho mode.

    As you mentioned, the sorting layers need to be adjusted.

    You will also find in this Extra Settings panel, the Sorting Layer ID & Sorting Order which allow you to control these options.



    Please be sure to visit & register to the TextMesh Pro User Forum where you will find similar information and more and should you run into any other issue, please feel free to post :)
     
    Last edited: Jul 19, 2014
  15. Torninator

    Torninator

    Joined:
    Jun 17, 2014
    Posts:
    11
    Fantastic, thanks!
     
  16. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    You are welcome :)
     
  17. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Improved Word Wrapping & Line Breaking
    I have had several users requesting improved word wrapping & line breaking to handle the specific needs of Asian languages. Here is a video showing the first implementation of this improved system. I would love to get feedback on this.

     
  18. JFo

    JFo

    Joined:
    Dec 9, 2007
    Posts:
    217
    Hi Stephan, and thanks for the great asset!

    Is there any way to change the size of the superscript text? Currently using size tags ruins the vertical alignment with the base text. Or is there way to use the size tags and alter the vertical position of that text to fake the superscript? Unfortunately I'm not able to split the string in separate text mesh pro objects so I'll have to do it just using tags...

    Thanks!
     
  19. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Thanks and you are welcome.

    The is not at this time.

    I am not sure I understand what you mean by it ruins the vertical alignment.

    BTW: I have revised how line spacing is handled when using the size tag which will make it consistent with how MS Word handles it for instance. Take a look at this post / video to see those changes.

    Not at this time but I have been thinking about a tag similar to <pos> tag but one that could allow you to move the subsequent text up or down.

    But before looking at these options, help me get a better understanding of what your issue is with the current implementation of superscript or subscript which is pretty much how it behaves in MS Word for instance.

    Here is an example using superscript and subscript in TextMesh Pro.



    This second image is from MS Word
     
    Last edited: Jul 21, 2014
  20. JFo

    JFo

    Joined:
    Dec 9, 2007
    Posts:
    217
    Thanks for the prompt reply!

    What I would like to get is a smaller size superscript which is top aligned. The size tag would work if there could be a tag like <pos> but for vertical offset...

    Hope this will make it more clearer:
    Capture_TMPro.PNG

    Thanks!
     
  21. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Superscript is typically aligned with the Ascender and thus not top aligned. However, let me see what I can do here.

    Out of curiosity, any reason why you want it top aligned? Also, be mindful that the top of "A" is not the same as "a" so top aligned to which of those two letter? Number are pretty much all the same height so using size + a new tag to allow moving the characters up should be fine.

    P.S. Sorry this reply took longer, had to sleep :)
     
  22. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Is there already a release-date for the new update(s)? :)
     
  23. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    New! Superscript & Subscript - Size + Offset Control
    I have modified the TextMeshPro Font Assets to now include fields for Superscript & Subscript Offset position as well as Size (0.25 ~ 1.0) or 25% to 100% of Font Size. This now gives you control over the positioning and size of Subscript & Superscript.


    Example showing adjusted offset for Subscript & Superscript.




    By default: The Subscript position is the same as the underline position defined in the font TTF. The size is 0.5 or 50% of the base font size.
     
  24. JFo

    JFo

    Joined:
    Dec 9, 2007
    Posts:
    217
    Amazing! Thanks a lot, Stephan... That was quick!

    The reason for the superscript placement is purely to match the visual style of our game.
    We changed the game's HUD text to use Text Mesh Pro instead of NGUI's label and it seems
    it was an excellent decision! ;)

    Any estimate when the new version with this feature are available?

    Thanks again and keep up the good work!
     
  25. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Doing my best to keep my users happy and trying to earn those 5 Star reviews :)

    I don't have NGUI but I would love to get more feedback on how TextMesh Pro is working with NGUI as it could be a nice selling point to get more people interested in TextMesh Pro. Spreading the word about TextMesh Pro is proving to be challenging as I am not sure how many people really pay attention to this Asset Store or the WIP thread.

    This next release is pretty big since it includes the Text Container and a bunch of other related stuff. I am also trying to get the Text Input component in there. I am hoping to get something out over the weekend.

    You are welcome and I'll keep it up :)
     
  26. JFo

    JFo

    Joined:
    Dec 9, 2007
    Posts:
    217
    Just wrote one. Hope it helps to attract more customers...

    I made my own NGUI "widget" for Unity's Text Mesh that uses custom string implementation to reduce allocations and thus replace the NGUI's UILabel. Nothing fancy. I'll now try to convert it to use TMPro to even easier integration. But, in general it is already quite easy to make a NGUI widget object and put the other gameobjects like TMPro as a child and get the anchoring and simple animations to work. Anyway, I'll let you know, if I'll run up any problems...
     
  27. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Hi,

    I am highly interested in this product but would like to know if a similar solution will be part of Unity 4.6.
    Can´t effort to pay "twice".....

    Thanks,
    Carsten
     
  28. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Thank you :)


    Keep me posted and please make sure you register to the TextMesh Pro User Forum and post some examples of your work with TextMesh Pro in the Showcase section (when you have a chance) :)

    In terms of allocations, if you use the .SetText() function instead of .text, you will also avoid allocations on the calling side.

    TMPro is allocation free other than when the object is created as I have to allocated the buffers or when the character count exceeds the buffer size. For instance, at object creation time, if the text contains 17 characters, then the allocations are for 17 characters (keeping the mesh and allocation as small as possible assuming the object is static). If you then at run-time change the text to have 23 characters, then the buffers will be re-sized to contain up to 32 characters. At which point updating the text each frame will be allocation free.

    Please note that in the editor, in order to keep the editor panel in sync with the .SetText() some allocation is happening but when your build it, it will be allocation free.
     
    Last edited: Jul 22, 2014
  29. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The TextMesh Pro uGUI component will be included / available to all existing TextMesh Pro users. I am planning on having it available when Unity 4.6 is released.

    There are some previews of the TextMesh Pro uGUI component in this thread as well as on the TextMesh Pro User Forum. Here is one of those preview in case you haven't seen it yet.

     
    Last edited: Jul 22, 2014
  30. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Thanks Stephan,

    unfortunately you missunderstood me. I wanted to know if Unity developers are perhaps planning to include their own new 3d-text-rendering solution in 4.6, completely independing from your great product but offering a similar quality.
     
  31. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Unity 4.6 does not include any changes to the text rendering system. As such, I decided to create the TextMesh Pro uGUI component to bring the functionality of TextMesh Pro as well as its State-of-the-Art text rendering capabilities to the new uGUI system / Unity 4.6.
     
  32. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,347
    Ok, now I see - thanks!
     
  33. Doddler

    Doddler

    Joined:
    Jul 12, 2011
    Posts:
    269
    It sort of works in NGUI. By default NGUI elements draw over TextMesh Pro due to render priority, but NGUI offers the ability to manually adjust the render queue for panels, so you can get TMP to appear in front by lowering the panel priority. I have trouble making NGUI respect zorder, so if you have multiple panels and need TMP text to appear in front of some panels but behind others at the moment requires making copies of the TMP shader and adjusting the render queue. Since my game doesn't have TMP text getting obscured it's not an issue for me, but perhaps being able to adjust the render queue might be handy?
     
  34. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Doesn't the option in the Extra Setting (Sorting Layer) solve that for you in TextMesh Pro?
     
  35. Doddler

    Doddler

    Joined:
    Jul 12, 2011
    Posts:
    269
    I keep missing the extra options menu, oops! It seems you are in fact right, changing the sorting order does actually allow you to sort them properly. Guess that makes it even easier.
     
  36. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    You are not the first to miss that panel. Maybe I need to give it some glow animation :D

    That options works really well. However, I have on a few occasions forgotten that I was using it and ended up puzzled for a few minutes as to why the order was wrong. Kind of some of those "DOH!" moments. :confused:
     
  37. Nikola-B

    Nikola-B

    Joined:
    Jan 31, 2014
    Posts:
    42
    I missed that one as well :)

    That is going to be pretty handy as well.
     
  38. Doddler

    Doddler

    Joined:
    Jul 12, 2011
    Posts:
    269
    So here's a bit of a random question... is it at all possible to do paragraph spacing? I have a bit of an odd case where I have blocks of text where I need spaces between them, but using a blank line is too much. Is there a way to adjust line spacing inline? You showed off a few weeks back changing line spacing with size tags, but I guess that's not made it into the release version yet.
     
    Last edited: Jul 23, 2014
  39. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Let me see what I can do here.


    P.S. I checked for Alerts on the forum this morning and nothing showed up. Sorry I was late to notice your post.
     
    Last edited: Jul 23, 2014
  40. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Here is an option for you (Doddler) ..

    I added a new property TextMeshPro.paragraphSpacing; which adds / reduces the spacing that line feed (AscII 10) adds. This works in conjunction with line spacing which adds / reduces spacing between lines including those with line feed.

    upload_2014-7-23_16-12-1.png
     
  41. Alex Storm

    Alex Storm

    Joined:
    Jul 21, 2014
    Posts:
    11
    Add me to the list of those users who need that Text Input component. :)
     
  42. Doddler

    Doddler

    Joined:
    Jul 12, 2011
    Posts:
    269
    Awesome, I can't wait to give it a try. if I could add more stars to my review I would! The text input component also looks really handy!
     
  43. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Thank you for the review and your support :)

    My biggest challenge right now with TextMesh Pro is making more people aware of its existence. I certainly could use all my users help in doing so. Any chance you have to let people know about TextMesh Pro would be greatly appreciated.

    For instance, if you think TextMesh Pro is a great asset, please let others know in this "Must have" asset thread in the Gossip forum.
     
  44. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Quick Update: Text insertion and deletion is done. Mouse and cursor navigation is done. Working on text selection (mouse or shift key + cursor) which leads to copy / cut / paste of text.

     
  45. Nikola-B

    Nikola-B

    Joined:
    Jan 31, 2014
    Posts:
    42
    This is shaping up to be another nice addition to your product. I can't wait to get this new Text Input component.
     
  46. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    :)
     
  47. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    649
    Hey, fantastic product! A few questions though.

    Is there any way to get the size of the entire text mesh? I'm looking to create an e-reader type component, and because we may want to embed images, links, etc., I figure the best way to do this is to create a testmeshpro object for each word and manually figure out the placement. However, in order to do this, I need be able to test for the size of each textfield.

    If there's built in link functionality (clicking on a specific word does X), then please let me know :)

    Thanks a lot. This product has been a game changer for working with text in unity!
     
  48. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Thanks

    You can get the bounds of the text which will give you its size. Now if you need to get the that information without rendering the text, you can also use GetTextInfo(string text) which returns a bunch of information about the text without rendering it.

    From the release notes:
    • Added a new function - TextInfo GetTextInfo(string text) which returns the TextInfo for the supplied string without generating the text object itself.

    I am working on the Text Input component which required I add functionality to track the mouse location relative to characters. This same functionality could be leveraged to track words or links to do something with them.

    You are welcome and please help spread the word about TextMesh Pro :)

    P.S. Here is a current thread in the Gossip forums about "Must have" assets where you can let others know about TextMesh Pro.
     
    Last edited: Jul 27, 2014
  49. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Hey there.
    Is something like this possible already?

     
    gresolio likes this.
  50. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    This one is trickier. However, in the next release, the new TextMeshPro.meshInfo contains all the mesh structure which can then be manipulated. The TextMeshPro.textInfo.characterInfo[] allows you to know about each character and more specifically which vertices they use. So instead of having the TextMeshPro render the text, you will be able to use a flag DONT_RENDER_MESH to then use another script to alter the position of certain characters and then render the text.

    This would enable you to apply a sin wave or jitter or whatever effect you wish to have on certain characters.
     
    gresolio likes this.
Thread Status:
Not open for further replies.