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. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    No rush! It's 21:41 here... I will go to sleep soon :p
     
  2. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Ok. This one is tricky since I am not familiar with FlowCanvas and how it works.

    Your first question in terms of how this would be handled through scripting is simple as you would simple append a new line to the text by using some string operation like:

    Code (csharp):
    1.  
    2. m_TextMeshProComponent.text += "\nThis is the new line of text";
    3.  
    However, I have no idea how to do this in FlowCanvas. How to concatenate strings isn't really related to TextMesh Pro but string operations and I have no idea how to do that in FlowCanvas.

    The second question is basically the same thing where you are trying to do a string operation.

    My suggestion is to reach out to the author of FlowCanvas to figure out how to do string operations in this tool.

    P.S. For the second question, you might want to use the SetText() function to avoid GC but that comes later once you have figured out how to handle strings in FlowCanvas.
     
    Last edited: Mar 1, 2016
  3. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Got it. So basically you are doing a += ... meaning that I'm adding this string to the old existing string.

    Another question would be... how do I add a scrollbar? When there is to much text in the box I want a scrollbar to appear. Do I do this normally like Unity UI or you have a special function?

    Thanks <3
     
  4. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Same as Unity UI.

    Please note there are (2) TextMesh Pro components. If you are using the Canvas system, make sure you are using the TextMeshProUGUI component which is located in GameObject -> UI -> TextMeshPro Text
     
  5. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Oh right. Good to know. I use Unity UI in general... but for TextMesh Pro I used the normal one and not the UGUI one.
    I guess I need to read some documentation.
     
  6. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Or watch some of the videos :)

    Make sure you register to the TextMesh Pro user forum and update to the latest release.
     
  7. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    It seems that I can use String.concat.



    That way I can combine two strings. Also, since you told me about the += and the /n ... we might have something here :D I will test this when I get home.
     
  8. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367


    This is a very rough test. the /n does not work. Am I doing something wrong?
     
  9. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    No idea as this is more related to FlowCanvas and how it handles all these string operations. When you inspect the text object, you should see if the text is getting set correctly.
     
  10. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    It's not. I think the /n might be escaped.

    Thanks for your help and sorry for mixing things up :)
     
  11. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The character is "\n" and not "/n".
     
  12. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367


    Oohhhhh.... this feels good.
     
  13. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Ok. This is really really cool. In case someone is wondering how I did this:



    Basically the ### Game Started ### is being send by my OnAwake fuctions:

    Every time I move, I also send an event that looks like this:

    As you can see I can even add style and stuff :D

    Finally, my UIController looks like this:

    I receive an event with a String. I get that string and I attach that $newLineChar (which basically is \n ). That way I know that each new text I receive will start on a new lane. Then I take my text and I concat it with my current $textLog variable. Then I update the $textLog value to have... everything. Once I have everything I just set the TMP Text to the new value!

    Bam magic!

    Now I have to implement some kind of scroll bar... and I would love to implement a "fade out" to the top of the chat log. Scroll bar is required, the fade out is more of a polish thing :p

    Just a question, is there a limit on how big the "$textLog" value can be before things start to crash?
    Also, if you have any suggestions on how to improve me please tell me.

    Thank You!


    EDIT: Is there a doc with all the style's I can use? <b><#00FF00>, etc
     
  14. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    GamerPET likes this.
  15. GamerPET

    GamerPET

    Joined:
    Dec 25, 2013
    Posts:
    367
    Thanks.

    I'm trying to implement a scroll bar but with no big success. I modified the TextMesh Pro to be from the UI. I followed some tutorials and they all do the same thing.

    You have a "RectMask" that has an image, a mask and a scroll rect. I made it to be vertical only and I selected my new scrollbar to be set up as a Vertical Scrollbar. I also set up my scroll rect "content" to my textMesh Pro component & the viewport.

    The scrollbar works... the masking works... but the scrollbar size is not changed. It's always set up to full.

    I know this is more unity related but I figured out that there might be some TM Pro setting that I have not set up?

    Thank You
     
  16. novello_io

    novello_io

    Joined:
    Nov 22, 2009
    Posts:
    293
    Sorry if this has been asked/answered as it seems like a common case (but couldn't find it in search):

    If we're wanting to use TMPro to make worldspace meshes, for instance to print a number on a card for a 3d card game, is there a setting to enable this so that the mesh doesn't render on top of objects which are physically over them?

    If so, are these still able to be batched (I think they are batched now?) Such like I can have 36 cards with 1 number on each, and have 1 draw call for all 36 numbers?

    Thank you!
     
  17. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    For objects in worldspace, you can use either of the TextMeshPro components and they should sort correctly.

    If using the normal TextMeshPro component which uses the mesh renderer, they should all batch into a single draw call. When using the Canvas system, it has its own way of handling batching depending on the order of objects in the hierarchy. How objects are parented can also affect the batching process.

    In either case, the whole batching process is handled by Unity so the TextMesh Pro objects follow the same rules as everything else.

    If you run into any issue with any of this, please feel free to make a post on the TextMesh Pro user forum. There is also the example floating text example part of TextMesh Pro which shows an example of something similar.

    P.S. I am seeing a strange behavior when using sprites with the Mesh Renderer which breaks batching. I might have stumbled upon a bug in Unity so this is not related to TextMeshPro.
     
    Last edited: Mar 3, 2016
  18. sicga123

    sicga123

    Joined:
    Jan 26, 2011
    Posts:
    780
    I've just started using Text mesh pro, swapping out normal text objects for the text mesh pro UI text objects. I'm not actually able to see the text written in the Unity scene. I was at first but then copy the text mesh object, leaving Unity and reopening it later on, none of the text objects can be seen on screen, they're in the inspector but not visible. Do I need to constantly do a refresh or reload, or shouldn't I copy the text mesh pro object but instantziate them individually via the menu? Any help would be greatly appreciated.
     
  19. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Are you replacing UI.Text objects by new text objects created using the Create - UI - TextMeshPro Text object or are you deleting the UI.Text component and manually replacing it by a TextMeshProUGUI component?

    See the following video about how to add new text objects in the scene.


    Also what version of Unity are you using?

    You should register on the TextMesh Pro user forum if you have not already done so and grab the latest release of TextMesh Pro available there.
     
  20. sicga123

    sicga123

    Joined:
    Jan 26, 2011
    Posts:
    780
    I'm using Unity 5.2.3 p 3 - I added the original component by creating it from the create menu as UI > text mesh pro. I then duplicated the object. However, I watched your video and then swapped out a button text with the text mesh pro UI text and everything just popped back into visibility. I did suddenly get an entire stream of Null references based on the text mesh pro components, so not quite sure what is going on there.

    I'll sign up for the forum as soon as I can locate the invoice.
     
  21. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Something is going on as this is simple functionality.

    I suspect a potential issue when the package was imported into your project as the Unity Asset Importer can be flaky at times. I suggest you deleted the entire "TextMesh Pro" folder (make sure you back up any font assets or files you may have saved inside the TextMesh Pro folder first) and then re-import the package.

    Also if you look in the header file of the TextMeshPro.cs file, you will see the version number of the release you are using. What version is that?
     
  22. sicga123

    sicga123

    Joined:
    Jan 26, 2011
    Posts:
    780
    I'm using 0.1.52 beta 3.1. I deleted then reloaded the package. Got only 2 null references but otherwise it does now seem to be running ok. I'll check on the null references when i open up unity later there might be an obvious solution, both were to do with text mesh pro, might just need a third reimport..
     
  23. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    You should not be getting any errors or null references so something is still a miss. Since you are not using the latest release, I suggest you track down your invoice number and get the latest release from the user forum.

    You can get the invoice number by logging on to the Asset Store and going to your Account - > Credit Card / PayPal. There you will find the invoice number for all assets you have purchased.
     
  24. sicga123

    sicga123

    Joined:
    Jan 26, 2011
    Posts:
    780
    I solved the Null references everything seems to be working fine now. I'll sign up for the forum a.s.a.p. Thanks for the info.
     
  25. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I made further improvements to the Font Fallback system where you will now be able to assign Fallback Font Assets for individual Font Assets in the Font Asset Editor Panel.

    Here is an example where I have a text object using two different fonts which are ARIAL SDF and IMPACT SDF. Neither of these font assets include the Greek character for Omega "Ω" or "\u03a9". So without the Fallback Font Asset support, we would be getting something like this.

    upload_2016-3-4_16-45-33.png

    Now by creating another Font Asset for ARIAL which only includes the Greek characters which are from U+0370 to U+3FF Unicode range and assigning this new Font Asset as a Fallback to our main ARIAL SDF Font Asset in the Font Asset Editor Panel (as seen below) the missing glyph (square) is now replaced by the Greek Omega character from this new Fallback Font Asset.

    upload_2016-3-4_16-46-30.png

    upload_2016-3-4_16-46-14.png


    Now in the current release where the Fallback Font Assets are only defined in the TMP Settings file, TextMesh Pro would search thru this list of Font Assets and use the first Font Asset which includes this missing character. So as per our example here, we would end up with the ARIAL version of the Omega character although using the <font> our text is now using IMPACT SDF. With this new change which will be included in the next release, TextMesh Pro will now search thru the Fallback Font Assets of the currently used Font Asset and then if it is unable to locate the missing glyph, look through the list of Fallback Font Assets defined in the TMP Settings file. Below is the result using the new implementation where you can see the IMPACT version of the Omega character is used.

    upload_2016-3-4_16-47-4.png
     
  26. vivalavida

    vivalavida

    Joined:
    Feb 26, 2014
    Posts:
    85
    Hi @Stephan B,
    (TL;DR)any update on the character substitutions?

    I'm trying to add Hindi text in my game, but I'm have all sorts of trouble to get it working in unity(it doesn't even display in the inspector).
    Your asset is the I've come to get things working. However, the order of combined characters is wrong in some places, on checking some of the other posts it seems that this is on your road-map, I would like to know it's status if possible.
    Also if you have any other alternative solutions, it would be of great help.

    Thanks a lot.
    Have a great day.
     
  27. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Support for diacritical marks, character substitutions and more advanced character shaping is definitely on the road map. Unfortunately, I don't have an ETA yet but this is something that is high priority after the next major release.
     
  28. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    400
    @Stephan B I just picked this up as it looked awesome, and spent the day replacing all of my uGUI text with this. Everything was working perfectly until I built a standalone app of the game - now all the text is being rendered as pink boxes. Seems like the material is missing or something, but going back to the editor everything works fine.

    Taking a look at the player.log, I notice these lines:

    Code (CSharp):
    1. Unloading 8 Unused Serialized files (Serialized files now loaded: 0)
    2. WARNING: Shader Unsupported: 'TMPro/Mobile/Distance Field' - Pass '' has no vertex shader
    3. WARNING: Shader Unsupported: 'TMPro/Mobile/Distance Field' - Setting to default shader.
    4. WARNING: Shader Unsupported: 'TMPro/Distance Field' - Pass '' has no vertex shader
    5.  
    Any idea what could be causing this and how to fix it?

    I'm using Unity 5.3.3f1, on OSX. I've tested both a OSX and Windows standalone build and this error happens on both platforms.
     
  29. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    You should not be getting such warnings along with pink rectangles which is indicative of missing shaders. Rest assured that all of this should be working fine so we just need to figure out why you are getting this behavior on your end.

    Are you getting this message during the build process or in XCode?

    In the build / player settings what are you using for Graphic API?

    Try loading one of the example scenes like "10 - Inline Graphics & Sprites" which is included with TextMesh Pro to see if you get the same results. If you do, try creating a new project. Then import TextMesh Pro again and see if you get the same results. This would rule out some strange import issue which unfortunately happens form time to time.

    I would suggest you grab the latest release from the user forum which is Release 0.1.54 Beta 1b or wait until I get the new release out most likely later tonight.
     
    DMeville likes this.
  30. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    400
    Thanks for the speedy reply! Yep you're right. I tried it out in a new empty project and everything works properly on the builds. Which must mean something is causing problems with it in my current project. :(

    The errors I posted above were from the player.log file (~/Library/Logs/Unity/Player.log) from playing the standalone OSX build. Below are the errors I get in the Unity console when building and my player settings.



    Screen Shot 2016-03-14 at 6.08.23 PM.png

    Screen Shot 2016-03-14 at 6.11.55 PM.png

    EDIT: I remember I had some a similar problem with another asset before. I opened up the shaders that were throwing the errors, added an extra empty line at the very bottom of the shader and saved. That seemed to fix my pink boxes, everything looks like it's working in the builds now. Super weird.
     
    Last edited: Mar 15, 2016
  31. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I have run into similar issues where a project or certain resources within a project get messed up. When this happens, I first make a backup of the project and then use the "Reimport All" option in the Assets menu and it seems to fix it.
     
    DMeville likes this.
  32. slava_pankratov

    slava_pankratov

    Joined:
    Jan 17, 2015
    Posts:
    42
    Hi! I have a project base on 2d toolkit and i2 localization and my custom english font (creating with bitmap font )
    Now I'm looking for an opportunity to add to the game Chinese,Arabic, Korean, Japanese and a lot of other languese but 2dtoolkit dont supported dynamic font.
    Can I quickly replaced 2dtoolkit text mesh by text mesh from your asset and use 2 font (my cusstom for english langue and dynamic font for other ) ?
     
  33. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    See my reply to your email from this morning.
     
  34. Exeneva

    Exeneva

    Joined:
    Dec 7, 2013
    Posts:
    304
    Hey there, have a simple question and hoping I can get a simple answer.

    Is it possible to convert a TextMeshPro UGUI Text into a Unity string type?
     
  35. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    You can't convert a TextMeshPro component into a string but you can certainly access the TextMeshProUGUI.text property which is a string.
     
  36. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The .text property takes in a string and returns a string.
     
  37. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    394
    Hey I'm new here, Text Mesh looks nice! I want to use it in my current game, do I have to replace all UI.Text manually? Another thing is other assets like Dialogue System may use text to display, how about their compatibility?
     
  38. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    There are two user created conversion scripts available on the TextMesh Pro User Forum. Here is a link to one of them. I have not personally tested these but I would assume they still work fine. Let me know if that is not the case or PM one of those users.

    I have not personally tested any of those assets. I would suggest you reach out to their author to find out directly and if they do not current support TextMesh Pro, it might make sense for them to add it.
     
  39. zhuchun

    zhuchun

    Joined:
    Aug 11, 2012
    Posts:
    394
    lol, its author
    Its author replied me with a whole support page for TMP ;) Cheers!
    http://www.pixelcrushers.com/dialogue_system/manual/html/text_mesh_pro.html
     
  40. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
  41. KWaldt

    KWaldt

    Joined:
    Nov 1, 2013
    Posts:
    122
    Hi there!

    How's the Input Field component? I've read in the forums that it might be in the next version, any estimate when that is?

    Best Regards,
    Kristina
     
  42. Raptcha911

    Raptcha911

    Joined:
    Sep 19, 2014
    Posts:
    17
    I'm just trying to make a simple line of text which uses more than one font.. I followed the exact same procedure as in the video, but its somehow not working right.. This is what I get
     
  43. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I have been working on the Text Input Field which will mirror Unity's Text Input Field in terms of functionality but should also work with rich text tag. Unless I run into some unforeseen issues, I am hoping to have this available at some point in April or sooner.
     
  44. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The Multi Font & Sprites support is available in the latest release which is currently available on the TextMesh Pro user forum. There is a release for Unity 5.0 ~ 5.1 and another for Unity 5.2 ~ 5.4.

    Once you have registered and been approved on the user forum, you will find these releases in the "TMPro - Alpha & Beta Releases" section of the forum.

    P.S. Since it is already past 5:00 am for me, I'll get your registration approved tomorrow as soon as I wake up and see it.
     
    Last edited: Mar 22, 2016
  45. KaiSD

    KaiSD

    Joined:
    Nov 25, 2012
    Posts:
    3
    Hi!
    I have 2 questions:

    1. If I have a team of 12 people, but only one actually works with GUI, should I buy 1 or 12 licenses of TextMesh Pro?
    2. Is there any way to try the plugin before actually buying it? I'm not sure how it will fit our project.
     
  46. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Since TextMesh Pro is categorized as Editor Extension, you will need one license per seat / installation. So in this case 12 licenses.

    Unfortunately, there is no trial version of the product available.

    In terms of fit, if your project contains a fair amount of text then you will likely benefit for all the features offered by TextMesh Pro.

    Besides the improved Text Rendering and Dynamic Text Styling capabilities , there are tons of additional features over UI.Text for instance.

    In regards to text formatting and layout. TextMesh Pro provides control over Character, Line and Paragraph Spacing, Kerning support, over 30 Rich Text tags, UTF 16 and 32, Links, Styles and the ability to use multiple fonts and sprites per text objects and more.

    If you have any questions about specific uses of the product, please feel free to ask or PM me. I am here to help :)

    P.S. Since it is now 4:00 AM for me, it is time for me to go sleep. So I'll have to answer any follow up questions tomorrow (well later today that is).
     
    Last edited: Mar 24, 2016
  47. KaiSD

    KaiSD

    Joined:
    Nov 25, 2012
    Posts:
    3
    Thank you for your answer, i'll discuss this information with the team.
     
  48. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,736
    I am using TextMesh Pro for the first time and see an issue. I basically copied text from one of the demos into my own scene and made some modifications. I noticed that the text is casting shadows on my terrain so I turned off shadow casting in the object's mesh renderer. It looks fine in the scene, but as soon as I run the game, the shadows are still there and when I exit play mode, the setting has been magically turned back on to cast shadows. How can I turn this off permanently for a text object?
     
  49. Stephan-B

    Stephan-B

    Unity Technologies

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    TextMesh Pro includes several shaders with different functionality. One of those is the Distance Field Surface which is designed to received scene lighting as well as cast shadows in the scene. Unless you want the text to be lit by scene lights as opposed to unlit, I suggest you switch to the Mobile Distance Field shader on the material that you are using.

    Most likely you are not using a Material Preset so I would suggest you take a look at the following video which covers this important topic as well as other important aspects of font asset creation.


    I also released a new version of TextMesh Pro last night which is available on the user forum. So I suggest you register to the TextMesh Pro User Forum and pick up the latest release there. There are also lots of information and tutorials available .
     
  50. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,736
    I don't see how changing to Mobile Distance Field shader would help. I tried that and it just gives me less spectacular looking text, but still with shadows. As far as Material Presets, as I said I just copied this from one of your samples and made a few tweaks. It's using the Bangers SDF Logo material. I also don't see how this has anything to do with turning shadows on/off with the Mesh Renderer. When I turn them off, they work fine in the Scene view, but when switching to Play mode, the setting automatically gets turned back on and remains persistent even after stopping the game. This shouldn't happen.
     
Thread Status:
Not open for further replies.
unityunity