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

TextMesh Pro - Advanced Text Rendering for Unity - Beta now available in Asset Store

Discussion in 'Works In Progress - Archive' started by Stephan-B, Feb 11, 2014.

Thread Status:
Not open for further replies.
  1. rutz

    rutz

    Joined:
    Aug 21, 2013
    Posts:
    51
  2. nirleka

    nirleka

    Joined:
    Mar 29, 2014
    Posts:
    8
    @Stephan B: First of all, thank you for creating TextMesh Pro.
    It is awsome and better when rendering font than other text mesh alternatives!

    However, I have slightly problem related with font atlas and font material.
    Is there anyway to get font atlas from existing TextMesh Pro font assets?

    AFAIK, the font asset creator embedded it into font asset.
    I need the font atlas because after updating Textmesh Pro (0.1.5 Beta 1.7) & Unity (5.2.4), The font atlas is missing / disappear from materials that i copied and modified from default font material (material is used for font styling). It make the material can't be dragged to TextMesh Pro Object in the scene or prefab while triggered errors.

    For now, I can fixed it by duplicate working material, copy the atlas (in material inspector), and drag it to TextMesh Pro game object in the scene / in the prefab.

    When the project become large with a lot of font material styles that spread across scenes & prefab this sort coming will be cumbersome to fix.

    As comparison, in 2D Toolkit's TextMesh, the font atlas & font material is generated as separated file and linked in font asset file. By doing it, I can update the font atlas or font material as I see fit and re-link it when connection is broken.

    Could you mind to add generate font atlas as separated, please?
     
    Last edited: Dec 21, 2015
  3. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    TextMesh Pro includes several functions that were added to the Material Context Menu which among other things enable copying and pasting font atlas from material to material.

    The various new functions that I added to the Material Context menu are explained in this video which also covers important tips about Font Asset Creation, Material Presets and the Context Menu functions.
     
  4. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    What about Text mesh pro input Box ..?
     
  5. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I am almost there. A few more things needed to get the Multi Font & Material released which I need to get out first since it does affect the Text Input component. Most of the backend needed to implement the Text Input component is already done and in the product so I don't expect it will take much longer after the Multi Font & Material is released.
     
  6. IvanTesseract

    IvanTesseract

    Joined:
    Jul 1, 2013
    Posts:
    109
    Hi,

    This looks like an excellent asset. But for my needs I have to be able to access the generated mesh.
    Is this possible?
     
  7. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Yes. The geometry can be accessed via the Mesh class as well as the TextMeshPro.textInfo.meshInfo[] array.

    The TextMeshPro.textInfo class contains several sub structure arrays which contain information about every character, word, line, link and the mesh.

    Here is an example where the geometry is being modified by another script. This example is available on the TextMesh Pro user forum.

     
    Last edited: Dec 28, 2015
  8. TechnicalArtist

    TechnicalArtist

    Joined:
    Jul 9, 2012
    Posts:
    736
  9. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Take a look at the following thread from the TextMesh Pro user forum which includes examples of this. The script used to create these FX is available to registered members / users of the product.
     
  10. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Making sure Multi Font & Sprite support works correctly with Masking & ScrollRect and Unity's Layout components.

     
    Last edited: Mar 5, 2016
  11. Luiz_Thiago

    Luiz_Thiago

    Joined:
    Feb 27, 2013
    Posts:
    32
    Hello friend!!!
    First of all, i love the TextMeshPro! Good job!

    I update the plugin, but now i have a lot of issues =(
    Every time when i open the Unity, all the Font Assets reference are gone! And a lot of warning/errors occurs!


     
  12. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    What version of Unity are you using and what version of TextMesh Pro were you using before that?

    As per the upgrade notes for the latest release, did you remove (delete) the previous installation of TextMesh Pro before importing the new package? Please be sure to make a backup of your project before hand.
     
  13. Luiz_Thiago

    Luiz_Thiago

    Joined:
    Feb 27, 2013
    Posts:
    32
    Damm... I deleted and reimported, and BANG! all work! =D

    Ty friend!!! =D
     
  14. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Excellent :)
     
  15. Teku-Studios

    Teku-Studios

    Joined:
    Sep 29, 2012
    Posts:
    257
    Hi!

    I'm adding the final touches for the tutorial of our game, and I'm trying to figure out how to do some specific thing. When we teach the player about the game's controls, I'd like to combine text and images so I can have something like this:

    Where [JUMP BUTTON] and [RUN BUTTON] are not text, but images (keyboard keys or controller buttons, depending on what input method you're using). It shouldn't be too difficult, but I'm not quite sure on the best approach. And the thing is that we have languages such as English, Spanish, Russian, Japanese... so the texts are completely different sometimes depending on the active language, and since I can't have a consistent text structure I need to come up with a custom solution for this.


    How can I achieve this with TextMesh Pro? I can't find the way to do it.
     
  16. Teku-Studios

    Teku-Studios

    Joined:
    Sep 29, 2012
    Posts:
    257
    Ok, never mind, I took a look at the example scenes and figured it out :D
     
  17. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Here is an image of a text object showing the use of Multiple Fonts & Sprites in a single text object as well as using a Fallback Font to handle missing glyphs from the currently assigned font asset.

    upload_2016-1-9_1-48-23.png

    Here is an image of the TMP Settings where the list of Fallback Font Assets can be defined.

    TextMesh Pro - Font Fallback Panel.jpg

    Adding another Font Asset like FontAwesome to the Fallback list makes it easy to also use icons from it. In this case, the Apple was added by using the UTF-32 support which is in the form of \U00001F79
    TextMesh Pro - Font Fallback - FontAwesome.jpg
     
    Last edited: Mar 5, 2016
    Teku-Studios and Peter77 like this.
  18. Teku-Studios

    Teku-Studios

    Joined:
    Sep 29, 2012
    Posts:
    257
    Nice, thanks a lot!
     
  19. dukester

    dukester

    Joined:
    Nov 7, 2012
    Posts:
    14
    I have a problem related to this.
    The Asset store window in Unity says "TMP 0.1.5 Beta 2.2", but when I download and import it, the header says "Beta Release 0.1.46 Beta 5.2".

    The main problem is this:
    I just blindly updated I2 Localization plugin and now I get two compiler errors, both saying:
    The type or namespace name `TMP_FontAsset' does not exist in the namespace `TMPro'
    I would normally post this problem in the I2 forum, but before I do I want to clear out if I'm in fact using the latest version of TMP, since I see in the Unity 5.2 & 5.3 section that you renamed TextMeshProFont to TMP_FontAsset, so I'm wondering if this change will also be made for Unity 4.6 (4.7) version of TMP.

    Speaking of 4.7, you should update your #if directives to include UNITY_4_7.
     
  20. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    There are different versions of TextMesh Pro available on the Asset Store for the different releases of Unity. Unfortunately, the Asset Store doesn't show what version is available for what release. It always shows the latest version # of the latest updated release. Basically, you have to read the release notes to know what version you'll be getting based on the version of Unity that you are using.

    To complicate matters even more, there is an issue with the Asset Store where it might not even provide the correct version of the Asset based on what version of Unity was used last to download. For instance, if you have multiple versions of Unity and download an Asset using Unity 5.3 and then open Unity 4.7 to download again, you'll be getting the Unity 5.3 release in Unity 4.7. The opposite is also possible.

    Having said all of that, the latest release of TextMesh Pro for Unity 4.6 is release 0.1.46 Beta 5.2 which is available on the Asset Store but given how the Asset Store can easily be confused, it might be easier to get that release for the TMP user forum.

    In terms of the TMP_FontAsset error, this class was renamed in the latest release for Unity 5.2 but remains named TextMeshProFont in previous releases.

    In terms of Unity 4.7, the only change required is adding the UNITY_4_7 to the compiler conditionals (as you pointed out).

    I do plan on releasing a new version for Unity 4.6 / 4.7 once the Multi Font & Sprites support is done. At that point, I'll update all releases which is 4.6 / 4.7 - 5.0 / 5.1 and Unity 5.2 +.
     
    Last edited: Jan 11, 2016
  21. dukester

    dukester

    Joined:
    Nov 7, 2012
    Posts:
    14
    This confirms I'm using the latest version of TMP (for my version of Unity, which I forgot to say was 4.7).
    Yeah, turned out to be a small bug in the I2 code, they introduced a new conditional to distinguish between the latest version of TMP and the previous ones, but they didn't update all of their files. It was an easy fix.
    Already did that, just thought to remind you to do the same in the next release.
    That's great news.
    Let me use this opportunity to say just how awesome your plugin is, and also your dedication and agility. I don't envy you at all on maintaining two versions of the (obviously quite complex) plugin.
    Keep it up.
     
  22. Stephan-B

    Stephan-B

    Unity Technologies

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

    Having to maintain 3 different versions can be challenging so hopefully Unity will keep backwards compatibility breaking changes to a minimal in future releases.

    On the other hand, in the latest release for Unity 5.2 & 5.3, I reworked the two TMP components to inherit from a common class which will make the maintenance of these difference releases easier going forward.
     
  23. TagScott

    TagScott

    Joined:
    Oct 17, 2014
    Posts:
    21
    Hi, I really love the plugin. We have only just converted all our Unity text to TMP and the performance difference alone is incredible.

    I have been having a couple issues with scaling. We use DOTween to scale tween some of our UI game objects and often if a child of the scaled object has TMP text the text will disappear. A workaround for this is to set the text to dirty when the tween has completed but as you can imagine this causes visual popping.

    Do you have any ideas on how we can solve this or what may be causing this? (We are running the latest TMP on Unity 5.2)
     
  24. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I presume you are using the latest release which is 0.1.52 Beta 3.1. The release # can be found in the header of the TextMeshPro.cs file.

    In order for the text to render correctly, scaling has to be uniform on the text object. This means X,Y,Z . Often users forget about Z and leave it at zero which will result in issues.

    Next, there is a minor issue which can happen with scaling for which are addressed by the following changes. See this post on the TMP User Forum related to this.

    Make sure you register on the TextMeshPro user forum and provide feedback in that thread please.
     
  25. TagScott

    TagScott

    Joined:
    Oct 17, 2014
    Posts:
    21
    Thanks Stephan, your suggested change in that post appears to have fixed the issue. I'll respond in that forum too. For the record I am using 0.1.52 Beta 3
     
  26. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Glad to hear that solved your issue :)
     
  27. gameDevi

    gameDevi

    Joined:
    Oct 14, 2015
    Posts:
    155
    does this work with unity 5.1?

    I've tried many versions but not having any luck.
     
  28. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    TextMesh Pro does work with Unity 5.1. However, there is a bug with the Unity Asset Store where it may not provide you with the correct version of an asset.

    I suggest you register to the TextMesh Pro user forum where all the versions are available. The latest for Unity 5.1 is Release 0.1.5 Beta 2.2.
     
  29. smada-luap

    smada-luap

    Joined:
    Aug 22, 2013
    Posts:
    945
    Very impressed with this. I've recently upgraded to Unity 5.2.4 and downloaded the update for that (beta 3.1) and it's reporting errors relating to GlyphInfo
     
  30. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Since this latest release includes pretty significant changes and given the Unity Asset Importer is very primitive where it has no ability to deal with files that are no longer necessary in a package, as per the Release notes, you have to remove the previous installation of TextMesh Pro by deleting the "TextMesh Pro" folder. Be sure to backup your project first and any files you may have saved inside the TextMesh Pro folder hierarchy. Then import the new release.
     
  31. smada-luap

    smada-luap

    Joined:
    Aug 22, 2013
    Posts:
    945
    I shall give that a go the next time I'm on my pc
     
  32. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Making sure text Overflow - Ellipsis mode works well with the soon to be released Multi Fonts & Sprites support.



    In this example, the text object is using (3) fonts and (1) sprite. As you can see the Ellipsis (...) is correctly inserted regardless of the target being a different font or sprite.
     
    Last edited: Mar 5, 2016
  33. MarkVincent

    MarkVincent

    Joined:
    Nov 18, 2014
    Posts:
    26
    Hi Stephan,

    I'm trying to find out if it is possible to wrap Text around an object (Mesh) liked a curved screen.
    I saw the Asset "Text Box" which does this, but it is no longer in development and refers back to your Asset.
    So, is it possible? Thanks!
     
  34. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Something like this :)



    In this example the text is bend on the z Axis but around an object (sphere) you would choose the Y axis for instance.

    Here is a link to a thread on the TextMesh Pro user forum which covers this topic and includes example scripts which you will be able to access once you register.
     
    Last edited: Mar 5, 2016
    myusernamereally likes this.
  35. DCrosby

    DCrosby

    Joined:
    Jan 13, 2013
    Posts:
    86
    Can you describe how you add the curve to the text ? (I've been reading from the beginning, and searches haven't showed me how to add a curve, will continue to read thread to the end...)
     
  36. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The VertexAttributeModifier.cs script is attached to the text object. This script contains several function to manipulate the text like Jitter, Wave, etc... One of those is the Warp which curves the text based on a Unity Animation Curve which is assigned in the inspector. The example uses an animation curve but this could be based on some equation instead to define the curve itself.

    Again, this script simply modifies the vertex attribute like position or color to do different FX.
     
  37. DCrosby

    DCrosby

    Joined:
    Jan 13, 2013
    Posts:
    86
    As a user this seems to be a nicer solution

    With the Bend Curves integrated into the Text UI, as another Property. This type of integration into the main TextMesh, or TextMeshUGUI is something that as a User I would look forward to. I would have purchased VText, but found the support for Text Mesh from other parties like DO Tween, a significant enough draw to get me to purchase TextMesh. But I was hoping the bending was further along, and the Video / Docs were just outdated.

    Also I assume you have to sign into the Beta on your forum to do this, as I can't find VertexAttributeModifier.cs in the asset you buy from the store.
     
    Last edited: Jan 24, 2016
  38. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I just approved your registration to the user forum. This will give you access to the latest releases and ability to download those scripts.

    Make sure you grab the latest version of that script.

    Remember there are two different TextMeshPro components. One for the Mesh renderer which replaces the old text Mesh and the other TextMeshProUGUI which replaces the ui text component.

    In terms of the bending / warping of text, the VertexAttributeModifier script was created to show examples of how the mesh and vertex data could be modified to do all kinds of things. It wasn't created just for curves. A more sophisticated implementation based / derived from this script could be created with some ui specifically for curving the text.

    I am sure that if a user created one that it would appeal to many users.

    I am out for a part of the afternoon but if you run into any issues, post in that thread on the TMP user forum and I'll be sure to check when I get back and give you a hand if needed.
     
  39. DCrosby

    DCrosby

    Joined:
    Jan 13, 2013
    Posts:
    86
    The Spline Text thing seemed to have some promise, any word back from that guy ?
     
  40. TagScott

    TagScott

    Joined:
    Oct 17, 2014
    Posts:
    21
    Hi Stephan,

    Hopefully a quick question for you. In MaterialManager line 56 you set the stencil comparison to 4 but I need to change this value (to 3) for a particular stencil mask I'm using. Is there a way to do this through the API?

    The issue we are having is that we read/write to the stencil buffer with a arbitrary write mask value of 128, but the TMP shaders use the whole mask (255) which causes conflicts. We can fix this by changing the stencil comparison op but perhaps it might make sense for TMP to use a read/write mask aswell. That way you can publicise the mask you are using and others could avoid the conflict.

    Thanks again
     
  41. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    You should be able to change the Stencil properties by accessing the material although I guess your changes might get overwritten by the MaterialManager.

    I tried to mirror Unity's implementation in terms of the Stencil Masking. I have also revised the implementation for the next release but I am open for suggestion on changes to improve flexibility.
     
  42. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Notice - TextMesh Pro user forum is experiencing a cold right now so access is down. Working with the hosting provider to get this back up and running as soon as possible.

    Update - This was an issue with the hosting servers which are now back and running.
     
    Last edited: Jan 26, 2016
  43. TagScott

    TagScott

    Joined:
    Oct 17, 2014
    Posts:
    21
    We don't get the conflict with Unity text so there must be a slight discrepancy between the stencil values used in the TMP shaders and those used in the Unity defaults.
     
  44. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I'll check the implementation again tomorrow and let you know what I find. It shouldn't be too complicated of a change.
     
  45. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    @TagScott I have been going over the implementation for masking and not certain about how Unity's own masking behaves with their text component as seen below.

    The image below shows objects which had two layers of masking (which worked fine) but when you disable the mask on the larger button, you would expect the text to be masked based on the shape of the smaller button but it is not. This seems like a bug to me. Is this how you expect it to behave?

    upload_2016-1-29_15-23-0.png
    Image showing UI Text with disabled masking on grey button and masking on smaller green button.

    Update : I went back to Unity 5.1 and everything is behaving as expected so this appears to be broken in Unity 5.2 / 5.3 and 5.4. It looks like when the mask is disabled on the parent or object, the masking component isn't releasing the mask.
     
    Last edited: Jan 30, 2016
  46. TagScott

    TagScott

    Joined:
    Oct 17, 2014
    Posts:
    21
    I agree that looks like a bug to me. I would expect if the text is a child of the smaller button it would be masked by the smaller button.

    I think the issue we are having is a little different. We have a scroll rect and inside that scroll rect is text. We have a button that is a sibling of the scroll rect and we write that button into the stencil buffer. Any text which overflows the scroll rect is clipped except the text that also overlaps the button. This only happens using TMP text and not using Unity text.
     
  47. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I was working on addressing the Stencil Mask read / write when I ran into this issue with Unity's UI.Mask. I should be able to get the read / write issue resolved. Any chance, you can get me a simple repro via email for testing?
     
  48. TagScott

    TagScott

    Joined:
    Oct 17, 2014
    Posts:
    21
    I'll try and get something to you asap
     
  49. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,690
    In case and of you Text Mesh Pro users also have a copy of MegaFiers I have just done an update that now means MegaFiers can deform Text Mesh Pro objects, so if you have ever fancied moving your text along a spline, stretching it, twisting, bending, etc then you can. Below is a very quick test showing the Text Mesh Pro surface object being deformed along a spline and then a Bend modifer being used to roll the text out onto the spline. Will do another video showing a few more effects soon.
     
    Stephan-B likes this.
  50. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,690
    A slightly longer video showing 5 different effects.
     
Thread Status:
Not open for further replies.