Search Unity

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. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I just approved your registration. :)
     
  2. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    and it's downloaded... the only problem with this Asset is you spend all your time creating new fonts - it's just too distracting... ;)
     
  3. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The following video should prove useful and covers Font Asset creation, Shader assignment as well as Material Presets.
     
  4. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,216
    Great! thanks Stephan B. In all fairness though, I wasn't being serious - my comment above was meant in a positive way - it's so rewarding and addictive you don't get on with the rest.... ;)
     
  5. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I did take those previous comments as a compliment :)

    I just thought since you were playing with Font Asset creation that the video would be useful.
     
  6. BrainAndBrain

    BrainAndBrain

    Joined:
    Nov 27, 2014
    Posts:
    115
    Hi Stephan B,

    Thanks for an amazing product. Burly Men at Sea (the game I'm working on) wouldn't be possible, or would be much more difficult, without it!

    I'm having an issue with bounds calculations. I'm using TextMeshPro to display text one character at a time, allowing the user to bypass this and display the line all at once. To properly place the text, I'm filling the text box with the entire line, positioning it, then using maxVisibleCharacters to hide all of the characters and a for loop to slowly display them. Here's the positioning code:

    TextMeshPro textMesh = GetComponent<TextMeshPro>();

    // Fill textbox
    textMesh.text = lineText;

    // Horizontally position
    if (textMesh.alignment != TextAlignmentOptions.TopLeft) {
    textMesh.alignment = TextAlignmentOptions.TopLeft;
    }
    textMesh.ForceMeshUpdate();
    float newX = .5f * (textBoxWidth - textMesh.bounds.size.x);

    // Vertically position
    transform.position = new Vector3(newX, textMesh.bounds.extents.y + iconHeightModifier, transform.position.z);

    // Then hide characters and display them to the user

    This works in many instances, but breaks in particular when a line of text is long enough to require text wrapping. I end up getting strange values, with textMesh.bounds.center.x returning a large negative value, and the size being about half of what it should be. After the line is finished being displayed the bounds values are correct, but until then they're wrong. I'm using the latest TextMeshPro beta on Unity 5.0.1f. Anything I'm doing wrong?

    Thanks a lot!

    - David
     
  7. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Can you make a post on the TMP User forum and upload your script so I can take a look at it?
     
  8. MrEsquire

    MrEsquire

    Joined:
    Nov 5, 2013
    Posts:
    2,712
    Hi, Im getting a issue using Unity 4.6.6p2 and Windows Store - Windows Phone 8.1 - TextMesh Pro v0.1.46 Beta 4.6
    When trying to build I get the following error messages:

    Code (CSharp):
    1. Assets\TextMesh Pro\Scripts\InlineGraphic.cs(55,33): error CS0115: 'TMPro.InlineGraphic.OnValidate()': no suitable method found to override
    2.  
    3. Assets\TextMesh Pro\Scripts\TMPro_UGUI_Private.cs(570,33): error CS0115: 'TMPro.TextMeshProUGUI.Reset()': no suitable method found to override
    Any ideas whats wrong, I cant upgrade to the next version of the beta as causes me issues (pink)

    Any ideas whats wrong?
     
  9. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Since these errors appear to be related to InlineGraphic and TextMeshProUGUI inheriting from Unity's Graphic class, it looks like there is an issue with Unity's own Graphic class with Windows Phone. I would do a search on that topic. Since most of the New UI components inherit from Graphic, there should be plenty of information about this.

    In terms of the pink issue, I would need more details. Pink means the shaders are not compiling. In beta 4.7, I left an extra shader "Mobile/Distance Field II" which will cause issues on mobile devices. That shader is not used and can be safely deleted.

    If you need further assistance please make a post on the TextMesh Pro User Forum and provide me with a Repro case if possible which would make it much easier to track down the (pink) issue if it is something else. The other issue is a Unity issue has these errors are inheritance errors which should not occur.
     
  10. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    TextMesh Pro's text auto sizing offers a 2X performance improvement over UI.Text best fit.
    Comparing TextMesh Pro - Text Auto Sizing to UI.Text - Best Fit


    See the following post on the TextMesh Pro user forum for profiler results.
     
  11. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Margin Rich Text Tag
    The margin rich text tag provides control over the left and right margin of a line or paragraph of text within the same block / text object.

    upload_2015-6-16_16-22-2.png
     
  12. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Edit: wrong topic.
     
  13. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Interacting with Text Objects using the TMP_TextUtilities Class
    Here is a quick overview of the new TMP_TextUtilities class which will make it possible to interact with characters, words, lines or links contained within a TMP text object.

     
  14. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    A TextMesh Pro user reach out to me asking how to implement and old style computer terminal simulation in TextMesh Pro. Here is what I came up with...



    This is using the same TextMeshPro.maxVisibleCharacters property which is used in the Reveal Text FX that I showed months ago. However since the text needs to be aligned at the bottom and based on the last visible line, I had to add new text alignment properties which are MaxVisibleLineLeft and MaxVisibleLineJustified.

    This is also using a UI,Mask component on the panel to mask the text as it reaches the top of the screen. This implementation works with Word Wrapping and all the other features / tags and doesn't use any string operations at all.
     
  15. Kea

    Kea

    Joined:
    Nov 12, 2012
    Posts:
    23
    Where i can download version with <margin-left> feature?

    I have beta 4.7 installed but this tag is not work.
     
  16. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The margin tag and several other features will be in the next release which should be out within a few days.
     
  17. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    HI
    Test Mesh Pro Without an ancher Tag ,is inComplete .....
    Kindly provide it in NExt update :cool:
     
  18. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    What do you mean by an Anchor tag?

    What is the use case for this tag?
     
    Last edited: Jun 27, 2015
  19. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    im making a twitter app and showing tweets,

    so I want it text to be clickable for user menstions, hash tags and links
     
  20. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Did you look at the post 763 (3 posts before yours) as well as this post on the previous page? ;)

    Support for interacting with text and link tag support will be in the next release. :)
     
  21. Games-Foundry

    Games-Foundry

    Joined:
    May 19, 2011
    Posts:
    632
    Hey Stephan.

    We're currently migrating to 5.1 and have downloaded the latest package from the support forum. We're witnessing vanishing sprites (mostly on buttons) which we suspect might be something to do with TMP (although that is not currently confirmed). Have you heard of anyone encountering this? I thought I'd ask before we spend time on trying to isolate the issue and produce a repro project.

    UPDATE: This is caused by a unity bug with atlased sprites not being rendered in the correct order. It is not related to TMP.
     
    Last edited: Jul 13, 2015
  22. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Nothing similar has been reported by any user. I am not sure how a child TMP object would cause the sprite on the parent button to disappear since there is no connection between the two (other than parent / child). This could very well be some Unity 5 issue.

    See if you are able to reproduce this with a small scene and post it on the TMP user forum or email it to me and I'll take a look to see what might be going on.
     
  23. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    thanx :)
    And when will b the next release ???
     
  24. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    New release should be available tonight or at the latest tomorrow.
     
  25. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    New Style Tag Overview
    Here is a video overview of the new Style rich text tag in TextMesh Pro which enables you to combine several tags into one for convenience.

     
  26. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    TextMeshPro 0.1.5 Beta 2 Release Notes

    New Features
    • Most Rich Text Tag have been updated to allow values to be defined in pixel units (px), font units (em) or as percentage (%).
    • Added a new margin tag to allow defining a margin for a line or paragraph of text. This new tag can be specified as <margin=10%> which sets both the left and right margin to the specified value. The left and right margins can be controlled individually using <margin-left=10%> <margin-right=10%>. The margin tag can be defined in pixel units, font units and percentage of the text container's width. Use </margin> to end the effect of the margin tag.
    • Added a new tag to control the width of a line or paragraph of text. This new tag is <width=100px> <width=2em> <width=25%> </width>. Added a new Example Scene 06b - Margin Tag Example.
    • Added a new tag to allow defining links within a block of text. The link tag is defined as follows: <link="name">The text part of this link</link>. In conjunction with the addition of this new link tag, a new linkInfo[] array has been added to the TextMeshPro.textInfo class. See the following introduction video related to the link tag


    • Added a new Style macro tag which enables users to define / combine multiple tags into a single tag. This Style tag is defined as <style="name">Text affected by this tag</style>. Style tag definitions are stored in the "TMP_DefaultStyleSheet" asset found in the Resources folder. Style tags can be managed by navigating and selecting this "TMP_DefaultStyleSheet" asset. See the following video


    • Added a new vertical offset tag to allow shifting characters and / or words contained within this tag. The tag is defined as <voffet=0.5em> <voffset=10px> </voffset>.
    • Added a new tag to indent the first line of text of a line or paragraph. This new tag is <line-indent=10px> <line-indent=5em> <line-indent=10%> <line-indent>.
    • Added the ability to define non-breaking spaces using the <nobr> <nobr> tag.
    • Revised and improved the implementation of Underline & Strikethrough style. Underline and Strikethrough now take into consideration point size. These changes also now make it possible to reveal text using underline or strikethrough.
    • Added a new Text Auto-size function where the width of the text can be reduced as a % before the point size is reduced. This is great for numerical sequences when trying to squeeze in a few more digits without changing point size which is typically more obviously visually. Please see the following video about this feature.


    • Added the TMP_TextUtilities class which contains several functions to track a position in relation to any characters, words, links or lines of text. These functions can be used to implement functions to interact with the text object. Please see the following video for more information


      This new release also includes a new example scene "06c - Link Example" which makes use of this new utility class.

    Fixes & Improvements
    • Revised how events are subscribed to in the editor when text objects are Enabled and Disabled. This change has resulted in removing all allocations related to enabling and disabling text objects as well as performance improvements.
    • Fixed a few shader issues steaming from Unity now computing lighting in world space as opposed to object space.
    • Improved how text is aligned vertically when using maxVisibleCharacters and maxVisibleLines. Here is an example https://lh3.googleusercontent.com/gsaFUfSfejPjnisxSeF09awKII6Wx2RUYqDhH8UxNA4=w1280-h640-no
    • Fixed some minor inaccuracies in the textInfo data. Added a new script "TMP_TextInfoDebugTool.cs" which can be added to any TMP object to visualize the data contained in the textInfo class.
    • Revised how tags are now parsed to make it possible to support more complex tags like <font="Arial SDF" material="Arial Shadow"> in the future.
    • Modified vertex colors so that only the alpha will affect the sprites used in the text object.
    • The Page Number used by the Overflow Page Mode now starts at 1. The array index for the first page remains 0. (FYI)
    • It is now possible to use Graphic.color to affect the vertex color of text objects.
    • Text objects now respond to Events in Unity like UI.Text objects do.
    • Removed the experimental Mobile Distance Field II Shader which was causing build errors on mobile platforms.
    • Font Asset Creator window is now using the new EditorWindow.titleContent and added compiler conditional to continue to use "EditorWindow.title" with older Unity 5 and 4 versions.
    • Added compiler conditional for Reset() and OnValidate() to get a round a new Unity bug introduced in 5.1.
    • Mesh Renderer received and cast shadow are no longer forced to off.
    • Few minor tweaks related to Unity's Layout Components.
    • Fixed some rounding error related to text auto-sizing (at small point sizes).

    Note: This is a partial list of the new additions and changes between Release 0.1.5 Beta 1.5 and this new Release 0.1.5 Beta 2.
     
  27. Kea

    Kea

    Joined:
    Nov 12, 2012
    Posts:
    23
    When can we expect a new version for Unity 4.6?
     
  28. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    I should be able to have one out within a few days.
     
  29. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    hi !
    I have button with textMesh pro ui As Child ,
    and text includes inline graphic ,

    Button target graphic refer textmesh pro ,

    the problem is it can not tint color on inline graphic .......
     

    Attached Files:

  30. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Can you please make a post on the TextMesh Pro user forum so we can get other users engaged in this as well?

    The reason for getting other users engaged is to figure out what behavior we want for the sprites.

    For instance, when changing the vertex color of the text object, do you expect it to tint the sprites as well? There are cases where the answer is yes and other instances where the answer is no.

    In addition, this button panel requires selecting the target graphic. The text and the inline graphic are two different objects. So again, it is a question of what the expectation is in terms of the behavior. A case can be made for both.

    So I am not certain how to handle it from a user point of view and I am sure there are a few technical issues I would run into.
     
  31. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    New release for Unity 4.6 is now available on the TMP user forum. The latest release is 0.1.46 Beta 5.
     
  32. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Hi

    In our game we use a lot of TextMeshProUGUI components. We noticed a while ago that creating them allocated a HUGE amount of memory. It turns out that this was from registering to a few delegates which is done during Awake. The reason is that delegates are immutable, so using the += operator on one will create the whole delegate list again. This results in quadratic behaviour and sometimes when we create a lot of text objects it will allocate several gigabytes.

    In the latest beta I thought you had fixed this since you had written
    However that change only fixed the case where text components are being enabled and disabled a lot. However it will still allocate the same large amount of memory when they are created the first time.

    Since we could obviously not have this in our game I looked for a solution and I think I have found a reasonable one.
    Essentially it consists of replacing the raw delegates with wrapper classes that can handle registering to delegates and removal of them in constant time instead of linear time. It would be awesome if you could fix this in a future release. Here is a link to the script I used if you want to have a look at it: http://pastebin.com/MDY9DhJA

    Screenshot 2015-07-03 13.30.16.png
     
  33. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Let me take a look at this and see what I can do.
     
  34. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    I sent a PM with the full diff as well if you want to take a look.
     
  35. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Yeah. I just replied to it just as you were posting :)
     
  36. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Ah :)
    Thanks for looking in to it.
     
  37. Kea

    Kea

    Joined:
    Nov 12, 2012
    Posts:
    23
    Great!

    <sprite> tag is not work for 4.6.1 without canvas. What i do wrong?
     
    Last edited: Jul 5, 2015
  38. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    hi!
    i have unity 5.1, and text mesh pro is not rendering font correctly.
    Untitled.png
     
  39. zyzyx

    zyzyx

    Joined:
    Jul 9, 2012
    Posts:
    227
    Are you using an overlay canvas? If so make sure you have a camera in your scene.
     
  40. JustinIsTheBest

    JustinIsTheBest

    Joined:
    May 29, 2015
    Posts:
    7
    Thanks for helping me out last time @Stephan B

    It looks like you are looking into the problem already. I just wanted to let you know, I'm experiencing a memory issue as well.
    I am running the latest version of TMPro, and one of the engineer's in my team said there is a memory leak coming from the TMPro prefab I made, and is crashing the app. He was unable to get a log, but every time we load the prefab or include it in the scene, it crashes our app as soon as it finished loading and Awakes happen.
     
  41. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Looks like it might be a non uniform scaling issue. The x, y, z scale need to be the same.

    You could also be using a non TextMesh pro shader. It is hard to tell what might be going on without more detail.

    If not one of those two things, you'll need to make a post on the TextMeshPro user forum and include some images of the inpector panel of the text object selected. Also make sure I can see the material including the debug panel of the material.

    Make sure your materials have a font atlas. Look into the debug section of material inspector for it.
     
    Last edited: Jul 7, 2015
  42. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    There hasn't been any memory leak type issues reported with any precious / recent releases.

    The only instance of app crashing that I have run into are Android related and do involve prefabs. It isn't a TextMeshPro issue but an issue in unity related to prefabs and scriptable objects and resources.load which would happen in awake.

    Having said that, the Asset Store release for Unity 5 already includes the changes related to allocations that post was referring to which relates to how event Event registration is handled. Please let me know if that is the version you are running and if the issue you are experiencing occurs with that one.

    At any rate, if you can post on the TextMeshPro user forum and include a repro or provide more details on the prefab and how it is instatiated. For instance, is it a TextMeshPro UGUI component or the normal component. If UGUI component, is the prefab using layout components? Again a repro is best to help me reproduce the issue and if not possible, just give me as much detail as possible.
     
  43. ludos

    ludos

    Joined:
    Nov 14, 2011
    Posts:
    56
    Hi, i have seen posts about a curved text feature (text along a bezier curve). Is this feature somewhere available?
    thanks
     
  44. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    The following thread on the TextMesh Pro user forum contains a script example which does allow curving text using an animation curve in Unity. Similar script could be modified to warp the text using different methods like bezier, etc.
     
  45. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    yes i am using screen Space overlay,
    and when i use camera , it start working correctly,
    but why i have to use camera with screen space overlay..??
     
  46. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Because of a bug in Unity where they are not setting the value for their built-in shader value "_ScreenParams". I have been in communication with Unity about this and was told they would fix it. I am just waiting for this fix.
     
  47. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    ok thanx :)
     
  48. half_voxel

    half_voxel

    Joined:
    Oct 20, 2007
    Posts:
    978
    Hi again

    Another bug in the latest release.
    In the TestMeshProUGUI class you have added this code (with commented code):

    Code (csharp):
    1. public override bool Raycast (Vector2 sp, Camera eventCamera)
    2. {
    3.     //Debug.Log("RaycastEvent. ScreenPoint: " + sp );
    4.     return true;
    5.     //return base.Raycast(sp, eventCamera);
    6. }
    This however causes CanvasGroups to stop working. Even if an object is set to block raycasts, it will still block them. Which is a bit annoying since we use TextMeshPro for tooltips and now we cannot click any buttons that have tooltips on them.

    Solution is to simply remove that method. I am not sure why you needed to add it, but for us it works if we just remove it.
     
  49. Stephan-B

    Stephan-B

    Joined:
    Feb 23, 2011
    Posts:
    2,269
    Reported on the TMP User Forum about a week ago. Still thanks for reporting it :)

    If I recall correctly, I wasn't getting the events until I added it but it now works without it so I have no idea what changed.
     
    Last edited: Jul 10, 2015
  50. ury2ok2000

    ury2ok2000

    Joined:
    Dec 29, 2012
    Posts:
    46
    Hey by chance can this read from a word doc say rtf xml or docx format (with images) and display properly?
     
Thread Status:
Not open for further replies.