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
    * NEW * Text Auto Sizing - Width Adjustment
    Added this new text auto sizing feature where the width of the characters will be reduced up to a certain % threshold before the point size of the text is reduced.

    The following video shows this new feature in action.


    This should be handy when the text almost fits the Text Container / RectTransform and instead of reducing the point size which is obvious from a visual standpoint, subtle adjustment of character width isn't as obvious. I think for numerical sequences that will be nice.
     
  2. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Using the TextMeshPro.textInfo class and Unity's Event System to interact with characters in a text object.

     
    Peter77 likes this.
  3. hattrik_4

    hattrik_4

    Joined:
    Apr 17, 2014
    Posts:
    4
    Hi Stephan,

    Sorry to bug you, but any updates on this?

    Thanks,

    Ryan
     
  4. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I'll look at it as soon as possible. Been focused on getting character, words tracking and soon links support in TextMesh Pro.
     
  5. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Update #2 on character & word tracking in TextMesh Pro.

     
  6. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    New Rich Text Tag
    Since it was pretty quick to do, I added a new Rich Text Tag tonight which is the <nobr> </nobr> tag which prevent line breaking between the tags.

     
  7. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    More Rich Text Tags Added
    Added two new additional Rich Text Tags which are <width=xx.x> and <margin-left=xx.x> to help provided additional control over text layout / formatting.

     
  8. codehesk

    codehesk

    Joined:
    Jun 16, 2014
    Posts:
    7
    According to your code in Textmesh pro as above, how do you change the shader on the text mesh? I am trying to make it to cull back on its display on the text. I am trying to make it enabled for with the 3d shader.

    http://wiki.unity3d.com/index.php?title=3DText
    Maybe if you can make a check box to enable this feature. Because I need it.
     
  9. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    See the following thread on the TextMesh Pro User Forum. You should update to the latest release of TextMesh Pro which are available on the user forum as ZTest and RenderQueue wasn't being set properly in previous releases. The linked thread (as well as links within that thread) also contain solutions to fix this in previous releases.
     
  10. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    New Offset Rich Text Tag
    The Offset tag is used to offset lines or paragraphs of text. This tag replaces the previous <indent> tag which is now instead indents the first line of paragraphs which is consistent with the html implementation of the text-indent tag.

    I refined the implementation of the <offset> tag to allow offset values to be specified in pixels, font units or as a percentage of the text container's width.

     
  11. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Coming Soon! Link Rich Text Tag
    Been working on adding support for links in TextMesh Pro. The format of the tag is <link="name">Insert Text Here</link>
    Information about the links contained in a text object will be available in the TextMeshPro.textInfo.linkInfo[] array. The linkInfo includes the index of the first and last character contained in the link as well as character count. It also contains a hashcode of the "name" to allow tracking the links.

    I also added a new utility function to allow tracking and interaction with links at run-time.



    Here is a video going over this new feature.
     
    Peter77 and Ostwind like this.
  12. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    is it possible to use web based images in between text?
     
  13. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    You can use the <sprite> tag which allows adding graphics inline with the text. See the following video and posts starting roughly here on previous pages.
     
  14. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    those sprite will come from web or need to be pre imported?
     
  15. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    You can create sprites runtime from images downloaded ie. with the WWW class.
     
  16. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    any example Ostwind, take me like very new to programing as I am more at graphics. Still learning.
     
  17. Ostwind

    Ostwind

    Joined:
    Mar 22, 2011
    Posts:
    2,804
    Nope, I don't have anything ready but there are examples around the net on how to download png and create a sprite of it runtime so all you would need after that is make it available to your text
     
  18. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    As Ostwind mentioned, those images can come from anywhere. Will these images all be the same size or of varying sizes?
     
  19. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    same size. And need to be changes as per scaling text (font size), just like what we see some special character in text.
     
  20. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    If you looked at the video (link) that I posted, the sprites are scaled / normalized based on the font size.

    Having the images all be the same size makes it so that the TextMeshPro Sprite Asset can be created ahead of time since the size and position of each image in the sprite sheet will always be the same (grid based). You will need to implement some method to load and pack each image into a texture as they are loaded which should be simple.

    How many images are you planning on loading / using? What size are each of those images?
     
  21. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    still not decided on number but they are more like mathematical signs so want be very big in size but the number will be definitely large.
     
  22. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    If they are 64 X 64 pixels, you can fit 1024 in a 2048 X 2048 Texture. The Sprite Asset would be pre-created to reference these 1024 images using a blank / mostly blank texture (don't know if you will pre-pack some images in it to begin). Then as you load those images from the web, you will need to add them into the texture which is already assign to that Sprite Asset and text object. At that point, <sprite=xx> where xx references the sprite / image will draw it along with the text.

    When you get around to working on this if you choose to use TextMesh Pro, be sure to register / post on the TextMesh Pro user forum that way, it will be easier to provide assistance and keep the information organized in its own thread.
     
  23. rahuxx

    rahuxx

    Joined:
    May 8, 2009
    Posts:
    537
    The issue is that the images will keep updating as we progress and we do not want our app do be made again and again
    We are keeping one variable which can be a gate between the sprite being used in text and web image.
     
  24. kbm

    kbm

    Joined:
    Aug 7, 2014
    Posts:
    84
    Hi, quick question:

    Is it possible to render single words / characters within a text object in a different way: e.g. make them glow, give them an outline etc.?

    I have read most of this thread and so far all I could see was that you could change specific characters with tags such as <b> or <color> but I want single words in my text to have custom effects (such as glow, glitch-effects, film-grain etc.)

    The effect I'm looking for would be a bit like the text in the game Kentucky Route Zero (see video):
    EDIT: The video didnt work but here's a screenshot of the effect (although it's hard to make out from a static pic)

    The word "zero" is shaded differently which really adds to the mood of the game and the designers put a lot of thought into that (it's sort of "shivering" in a way)

    Is that maybe already possible? If not, would it be likely to get implemented in the near future? Or maybe you have a tip for me to do some sort of workaround?

    Thanks for your awesome asset! <3
     
  25. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I wasn't able to find any video of the game showing the effect you describe. It would be helpful for me to see it.

    In terms of having different characters, words, etc have different dilation, outline, glow, etc, it would require using different materials on those affected characters, words, etc.

    Using different fonts or materials within the same text object isn't possible yet. However, it is one of the features that I will be implementing soon.
     
  26. kbm

    kbm

    Joined:
    Aug 7, 2014
    Posts:
    84
    Thanks for your reply! :)
    Here is a video:

    If you watch at ~24:10 you can see that the word "zero" has a special effect. It's very distinctive and not very much in your face, but I like it.
    Would it maybe be possible to get certain words' positions and create a layover-effect from another object or something like this?
     
  27. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    See the following post above which shows how you can access information about each character, word, lines and now links in the text. With that information, you could I guess add some sprite / transparent object in front of certain words to create some effects.
     
  28. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    New Rich Text Tag <style="name"> </style="name"> </style>
    Working on adding a new Rich Text Tag <style="name"> </style="name"> or </style> where you will be able to define what these tags do. Think of these <style="name"> tags as Macros where they contains several other tags. Here is an example:



    As you can see the <style=link> is actually made up of "<link="ID_01"><u><i><#40a0ff>" as well as "</link></u></i></color>". Besides making it easy to define different styles, it also keep the Text Input Box much cleaners.



    This is the first implementation. The green rectangles around the link shows the hit box of the link itself.
     
  29. Seith

    Seith

    Joined:
    Nov 3, 2012
    Posts:
    755
    @Stephan B Hi Stephan, I finally got around to implementing books in Ghost of a Tale and I'm trying to understand how to use the wonderful page feature you've created.

    I believe it is related to textInfo.pageInfo but for the love of me I can't figure out how to use it. I looked at your Youtube videos, I searched through Google, I looked at the official TextMesh Pro documentation, but not a word on coding or API related to page mode.

    Could you please let me know how to query the number of pages, or how to set the page number? Thanks...
     
  30. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Can you post on the TextMesh Pro User Forum? That way we can keep the conversion under one topic. Please provide some context on how you are trying to use the feature. The Overflow - Page Mode should handle the different pages automatically based on how the RectTransform is setup. Once you post on the TMP Forum, I'll post a script example of the page mode.

    Did you look at the following video?
     
  31. PlatformSix

    PlatformSix

    Joined:
    Feb 27, 2014
    Posts:
    57
    Does Textmesh Pro work in WebGL builds?
     
  32. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Yes. The only known issue was related to VertexColors which Unity fixed in 5.0.2. (Case 684659)
     
  33. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Here is a preview of the new TMP StyleSheet Editor which will work in conjunction with the new <style="name"> Rich Text Tag. This will allow users to create (macros) of tags keeping the Text Input Box in the inspector much cleaners.



    Here is an example of the Text Input Box without using this new Style tag and using the Style tag.

     
  34. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Updated the AssetStore which was created in Unity using TextMesh Pro.

     
  35. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
    Very useful update
     
  36. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I wanted to use Unity and TextMesh Pro to create the image for the AssetStore as opposed to using Photoshop for instance. So this is all TextMesh Pro :) The 5 stars in the review is using the <sprite> tag.

    BTW: This is only an updated image. The latest releases of TextMesh Pro are still only available on the TMP user forum which all registered users of the product have access to.

    P.S. I should have a new release available this week with the new <width>, <margin>, <nobr>, <indent-line>, <link>, <style> tags and some other stuff.
     
    TechnicalArtist likes this.
  37. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    I'm not sure how massive a feature request this is, but would it be possible to somehow add a 3D extruded mesh feature that allows us to create 3D text objects with TextMesh Pro much like this discontinued library:
    http://ttftext.computerdreams.org/
     
  38. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Ben-BearFish likes this.
  39. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
  40. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    That is still work in progress although I could probably release something within the next 30 days.
     
  41. Ben-BearFish

    Ben-BearFish

    Joined:
    Sep 6, 2011
    Posts:
    1,204
    Sounds great. That'll make your plugin the defacto anything text tool in Unity. Thanks.
     
  42. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    @Stephan B ,

    Having watched some of your demo/tutorial videos, do you include any of your 'effects' scripts with the Asset (like the teletyping effect) - or can you?

    Also, several types of ttf font are (sort of) image based rather than letter (for instance celtic knot patterns etc). Is there any easy way to use TMPro to, say, create a border of font text around the outside of a text box clockwise or whatever?
     
  43. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Most of those scripts are available on the user forum somewhere. There are also videos for several of those things like the reveal effect.



    Using those ttf fonts should work fine. However, since I haven't tried those fonts I have no idea how from a layout point of view they'll work. Someone will have to try :)
     
  44. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    I'll let you know...

    Another thought... you might be able to do this already... but can you insert a public variable value from a class/component in to the text using inline route ie. something like <var: game.items.mainWeapon.damage> ??? I dunno but if it could be done with inline text that would be superb...?
     
  45. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    You mean to be able to instead of displaying the var:.... to display its content?

    How would that be different then using string concatenation ie. "Part 1 of string..." + var.toString() + " something else..." or using the TextMeshPro.SetText("The value is {0:0}.", float);
     
  46. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    No different I suppose. . And I see you can insert images with text anyway...
     
  47. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The only downside to doing string concatenation is the GC allocations resulting from the string operation. That is why the .SetText() method was added to TextMeshPro.

    Now perhaps you had some other use in mind and if so please help me understand the use case.
     
  48. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    @Stephan B , . I'll go away and have more of a proper run at this Asset and come back on this if there is any further functionality I can think of.

    How close are we to the full asset store stable release for Unity 5.x?

    As an aside, any chance you might ever create a general UI asset with all the added functionality like TextMesh Pro? Nothing on the store really adds much to the NEW UI at the moment with added standardised UI widgets like flexible multi column list boxes, list views, table views, tree views, layers of tabs, that sort of thing...? Just a thought... ;)
     
  49. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I am pretty pleased with the latest releases of TextMesh Pro for Unity 4.6 and 5.0. These latest releases (based on user feedback and lack of issues reported) certainly appear to be more stable and pack a lot more features than the version on the AssetStore. However, I am not in a hurry to update the AssetStore package. Unity itself still remains in a state of flux (not as much now) but enough where it still feels more efficient and quicker to get new releases in the hand of my users via the TMP user forum.

    I am pretty sure not having a 5.0 release on the AssetStore and the warning that Unity issues is likely hurting sales so I do feel some pressure to update the package so who knows. I am working on a new release and should this one also go without any real issues being reported, I might update the AssetStore package.

    I don't have any plans to get into the UI business. However, adding support to allow text to flow from one text container to another and similar text related things are certainly within the scope of the world of text :)
     
  50. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    Understood. . Makes sense.
     
Thread Status:
Not open for further replies.