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 26, 2017
    Posts:
    6,595
    Unity made API changes in 2017.1 which are addressed in the release of TMP for 2017.1.
     
  2. blaager

    blaager

    Joined:
    Jan 5, 2014
    Posts:
    3
    Sorry, I wasn't being clear before. I have been using TextMeshPro-1.0.55.2017.1.0b11 (the one downloaded manually from package TextMesh Pro - Release 1.0.55.2017.1.0b11 (dll only).unitypackage).
     
  3. Akatosh

    Akatosh

    Joined:
    Jun 27, 2017
    Posts:
    7
    hi,@Stephan_B
    I get a weird issue. I create a prefab including one TMP-text object. When I drag it into the scene, the text shows correctly. But when I use "instantiate" in my script and use ".text=" to set its value, the text shows nothing in my scene. And I check the component's "TEXT INPUT BOX", the value isn't blank. I don't know if there is anything I did wrong.May you have a look at this plz. :(
    (and sry about my poor English...)
    thanks
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Make sure you are getting a reference to the correct text object.

    It would be useful, if you could post the script you are using to instantiate and set the text.
     
  5. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I am able to reproduce the behavior on my end. Currently looking into this. I'll provide feedback as soon as I have more information.

    P.S. The fact the TMP Input Field is working fine in .Net 3.5 but resulting in this error in .Net 4.6 points to either an issue related to IL2CPP or WebGL. I will poke the WebGL and IL2CPP folks to see if they have any idea.

    Update
    Looks like the issue is specific to .Net 4.6. I am trying to get more information on this.
     
    Last edited: Jul 28, 2017
  6. Akatosh

    Akatosh

    Joined:
    Jun 27, 2017
    Posts:
    7
    I used to use UGUI default text component and it's shown correct. I think I'm getting a correct reference cuz there's no error in the console and the name's "TEXT INPUT BOX" value is what I set.
    the instantiate script
    Code (CSharp):
    1. item = GameObject.Instantiate<T>(prefabItem, itemParent);
    the script of setting
    Code (CSharp):
    1. name = GlobalTool.FindChild<TextMeshProUGUI>(transform, "Name");
    2. ...
    3. name.text = text_CN;
    where GlobalTool is just a class.
     
  7. Akatosh

    Akatosh

    Joined:
    Jun 27, 2017
    Posts:
    7
    I want to put a screenshot but seems like I can't do this here...
     
  8. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    You will need to provide more information as the portions of code you provided are too limited.

    You will need to either provide a full script or send me a private message with a link to download a simple repro scene or project.

    P.S. Since it is already almost 2:00 AM for me, I'll get back to you tomorrow assuming you are able to provide me with the additional information requested.
     
    Last edited: Jul 28, 2017
  9. Akatosh

    Akatosh

    Joined:
    Jun 27, 2017
    Posts:
    7
    (I start a conversion and i think it's the way of sending private message?)
    And really thanks so much for these replies!May you have a good sleep:)
     
  10. cellarmation

    cellarmation

    Joined:
    Jan 17, 2015
    Posts:
    30
    I am now using a combination of alignment with preferredWidth & preferredHeight to determine the bounds of the labels. This appears to be much more reliable, thank you.
     
    Stephan_B likes this.
  11. Jargus

    Jargus

    Joined:
    Jul 11, 2017
    Posts:
    9
    I've run into something I can't explain, and I'd love some help. I've got a project where I've got some TextMeshPro items. I'm using a few different instances of TextMeshPro/Mobile/Distance field presets to change effects at runtime. For several days, I've been setting the TextMeshPro.alpha property at runtime to fix fade the text in and out, and it's worked great.

    Suddenly, today, for no apparent reason, setting the alpha property just stopped working. If I set it to 0, the text is transparent. If I set it to any other value, it's opaque.

    It looks like setting the color property with an alpha still works, so I'm updating my code now, but any ideas why setting the alpha property would just suddenly stop working?

    Thanks
     
  12. Jargus

    Jargus

    Joined:
    Jul 11, 2017
    Posts:
    9
    I take it back, setting the color property isn't doing what I want either. Trying to figure out what broke now.
     
  13. Jargus

    Jargus

    Joined:
    Jul 11, 2017
    Posts:
    9
    Don't know the answer yet, but it looks like whatever the alpha value is when the text is created is the alpha value that the text is stuck with.

    My best guess is that something is failing in the update loop, somehow blocking the text alpha from being updated, but I don't know what yet (and I might be completely wrong).
     
  14. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    @Jargus How are you changing the alpha of the text object? Are you using vertex colors, material color or a <color> tag?
     
  15. Jargus

    Jargus

    Joined:
    Jul 11, 2017
    Posts:
    9
    @Stephan_B I was originally using the TextMeshPro.alpha property. I tried changed to TextMeshPro.color property (with the a component set to my alpha value). The results of both is the same: the initial value is set and works, but all future changes are ignored. Originally, the alpha property worked as expected until it just suddenly stopped working.
     
  16. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    You have to keep in mind that in Unity, whenever you access material properties via .material, you end up with an instance of a material whereas if you access the .sharedMaterial you are changing the shared material which could be used by several objects.

    So in this case, as you change the alpha, you end up creating an instance with the new alpha value where this new instance as assigned to the text object.
     
  17. Jargus

    Jargus

    Joined:
    Jul 11, 2017
    Posts:
    9
    Understood, and I'm fine with that (at least for now). That still doesn't explain why it used to work, and suddenly stopped working.
     
  18. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    You might have changes something on your end in terms of what you are doing. Are you setting this alpha via a script?

    Can you provide the full script so I can test / look at it?
     
  19. Jargus

    Jargus

    Joined:
    Jul 11, 2017
    Posts:
    9
    There's a lot of scripts involved. I'm going to try spinning up another project to see if it repros. If not, I can try to back out the various changes I made today, but I can't think of any changes I made since this last worked that might impact it. If I can find a simple repro, I'll definitely shared it.

    It is being set via script.
     
  20. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    If you can narrow this down or create some repro that would be great and make it easier to isolate why this is happening.

    I'll be around most of the weekend. Although I am doing stuff with the family / kids, I still check the forums several times per day. So I'll be on the lookout for any repro or replies.
     
  21. Jargus

    Jargus

    Joined:
    Jul 11, 2017
    Posts:
    9
    Well, as expected, the simple repro works. So it's definitely something I've done to my project. I just don't know what.

    And it doesn't appear to be specific to TextMesh Pro, so I'll stop posting here. I have other effects (size changes, primarily) that are also not happening. Not sure what I broke, but I broke it good.
     
  22. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Like I said, just in case, I'll be around if you need anything :)
     
  23. Jargus

    Jargus

    Joined:
    Jul 11, 2017
    Posts:
    9
    For completeness, the problem code is my attempt to compute the "Menu Space" Axis Aligned Bounding Box for all items in my menu. I do it by iterating over all the mesh filters in my children, computing the eight corners for the mesh bounding box (in its local space), and transforming them into Menu Space, and then picking the min and max XYZ to produce a "Bounds" in Menu Space that includes all children.

    Not exactly sure why yet, but doing that breaks Alpha updates on TextMesh Pro and size updates on other GameObjects that are among those children. If I do the same thing for the colliders among the children, it works fine, but the colliders aren't in local space so it won't give me the right answer (the minimal bounding box)

    If you happen to know why getting the Mesh from the Mesh filter would breaks things, please let me know.
     
  24. Jargus

    Jargus

    Joined:
    Jul 11, 2017
    Posts:
    9
    sharedMesh works, so I assume this is just another instance of a property call creating duplicates.
     
  25. mrstolen

    mrstolen

    Joined:
    Jul 31, 2013
    Posts:
    6
    Hey, has anyone ever used TextMesh Pro and tried to change specific characters style? like put a character bold, but by using code instead of rich text?

    I am not being able to do it:
    exampleChar.style = FontStyles.Bold;
    exampleChar.scale *= 5;

    This doesnt work, I though it might be necessary for me to update geometry or something but It doesn't work either. Thanks in advance
     
  26. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    The content of the textInfo is mostly informative as altering the content of the textInfo (besides the geometry) doesn't affect the test itself.

    In terms of modifying geometry to do something similar, take a look at example 12 and while mousing over characters, hold the shift key. Take a look at the scripts used in that example as it provides for one way to modify the geometry and vertex color of individual characters.

    Can you provide more insight as to why you want to modify individual characters to make them bold? Ie. are you trying to do that to highlight those characters?
     
  27. CodeLiftSleep

    CodeLiftSleep

    Joined:
    Jul 15, 2017
    Posts:
    44
    I have just started using it, nowhere near to its full capabilities, but I have to say its awesome! The inline sprites are so useful to me since I displaying team logos along with their picks in a draft room simulation
     
    Stephan_B likes this.
  28. JMeer

    JMeer

    Joined:
    Mar 3, 2017
    Posts:
    29
    I am having some trouble creating a windows build. Using Unity 2017.1:

    Shader error in 'TextMeshPro/Sprite': variable 'OUT' used without having been completely initialized at line 84 (on d3d11)

    Shader error in 'TextMeshPro/Mobile/Bitmap': 'vert': identifier represents a function, not a variable at line 85 (on d3d11)

    Any idea's?
     
  29. Checko

    Checko

    Joined:
    Oct 23, 2013
    Posts:
    17
    hey all. Wondering if anyone else is encountering the following issue. Installed TMP and create a TMP font all good. But the inspector doesnt behave as expected. Under the shader the drop downs for Face, Outline, Bevel, Lighting, etc. are all empty. Clicking on Face will expand to show the other heading Outline,Bevel, etc. but nothing shows under thos headings. When viewing sample text i am able to see all the attributes that one would normally be able to edit under their respective heading but just unable to see it to edit in the inspector. Anyone else have this issue? Is it a 2017 issue? Any fix?
     
  30. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    That seems like some possible shader compiler issue. Please delete the Shaders folder and re-import it.

    Also make sure you are using the appropriate version of TMP for the version of Unity that you are using.
     
  31. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Make sure you are using the version of TMP for Unity 2017.1 which is link and available for download in this thread.
     
  32. mrstolen

    mrstolen

    Joined:
    Jul 31, 2013
    Posts:
    6

    Basically I want to make a dialogue system where I can, when authoring, say that some words will have specific animations.

    For example, when I write:
    "Today I saw a [Ghost]{Fade, 2} and I was really scared"

    My script currently will parse this string and write "Today I saw a " normally, then it will apply the "Fade" animation (with whatever arguments I think are important for each animation, in this case, there is a float that indicates the time between each fade) to the word "Ghost", and then it will write "and I was really scared".

    For now, my animations are simple. When called, I give the characters index from the start and the end of the string I want to animate (in this case the index of 'G' and of 't') and then perform alterations to those characters (like changing the alpha channel progressively).

    But I was trying to make some animations less simple (like giving a set of characters a different material and making them bold), but I cannot manage to do that by code.
     
  33. Checko

    Checko

    Joined:
    Oct 23, 2013
    Posts:
    17
    Thank you!!
     
  34. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Take a look at the Animating Vertex Attribute example scene and related scripts. Those are examples of manipulating the vertex attributes to animate part of the text.

    In terms of identifying which part of the text should animate, I was planning on adding a custom tag called <action="Name of function" params="0, 0, 0, 0"> where similar to how style tags are implemented, users could define their own custom action tags and functions that would be called by them. This is feature is not available yet but what I believe you are really looking for.

    Other than the convenience of the <action> tag to identify segments of the text to be modifying by some script, you should be able to implement most of this based on the example scripts like the one used in the Animating Vertex Attribute example.
     
  35. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    Hello. We have just integrated TMP in our projects. And i've just made build Windows Universal App SDK 8.1 and UWP 10 . I see in output console VS:

    upload_2017-8-2_9-48-24.png

    What should I do to run it?

    We are using
    upload_2017-8-2_9-49-23.png
    this plugin version now.

    In Unity Editor everything is ok. And other platforms builds (Android, IOS) works fine too.
    Problem only with UWP.

    Unity version:

    upload_2017-8-2_10-0-53.png
     
    Last edited: Aug 2, 2017
  36. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    What version of Unity are you running?
     
  37. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
  38. skyrusfxg

    skyrusfxg

    Joined:
    Jan 14, 2016
    Posts:
    127
    Reimprorted. Everything is fine. Excuse for troubling.
     
    Stephan_B likes this.
  39. dnoparker

    dnoparker

    Joined:
    Aug 28, 2013
    Posts:
    63
    Can you add hyperlinks to sections of text?
     
  40. lenten1111

    lenten1111

    Joined:
    Jun 10, 2016
    Posts:
    8
    Read like 10 pages still can't figure out how to fix it. Upgrade from 5.5.2 to latest beta. Already import the latest TMP from store. All texts are gone. get this



    Deleted it, reimport get this. All TMP text scripts gone. http://i.imgur.com/hsdwK7E.png

    Take a lot time with latest FB SDK on Unity 5.5, it doesn't work. On unity 5.6 FB SDK work fine. Now i have to deal with this. Could you please tell me which version for both of these without getting any error?
     
  41. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Take a look at the <link> tag and example 12 and 12a included with TextMesh Pro. In terms of implementation on your end, focus on understanding the 12a example which uses event handlers to detect interactions with the text.
     
  42. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I presume you are trying to upgrade from the free version of TMP for Unity 5.5 to the free version of TMP for Unity 5.6.

    As per the Release and Upgrade notes, you have to first remove the previous version of TextMesh Pro, by deleting the "TextMesh Pro" folder. Once the previous version is removed then import the latest release. Always be sure to backup your project first as well as review any changes you may have made in the TMP Settings, Stylesheet and Sprite Assets.

    If you were using a paid version with source code, then you need to stick to the paid versions. Those are available on the TextMesh Pro user forum as they have been over the past several years.
     
  43. mrstolen

    mrstolen

    Joined:
    Jul 31, 2013
    Posts:
    6
    Hey, I have one more question.

    Is it possible to give different face textures to each char on the same text?

    thanks in advance
     
  44. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    649
    Hi,

    We're using your paid 2017 version from your website in our game. I'm going to eventually lock in a version since this is an engine which will be used for a whole bunch of games over many years (we're redoing a series in Unity now), but compile times are getting too high.

    Is there any chance you can either (a) release your paid versions as .dlls as well, or give a very specific walk-through on how to turn your code into a .dll? I don't really want to play with your code since you have a lot of stuff going on in your product.

    Since your library isn't going to change for us, there's really zero reason to have it be source code and increasing compile time for multiple people. This is a pretty big deal to us ... I would *really* appreciate your help on this.

    Also: Is there anyway to extend your TextMeshProUGUI class and still get your editor to work? I couldn't get that working very easily, and I took the path of least resistance and just added another file to your partial class to add some minor functionality we needed ... but that's not going to work if we get a .dll made by you.

    Thanks so much!
     
  45. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    649
    I think I managed to turn the non-editor Scripts folder into a .dll, but I lost all references. Is there anyway to switch this while maintaining script references, or I would have to manually redo everything?
     
  46. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    It not when they all share the same material preset and texture assignment in the face slot.

    If draw calls were not an issue (and they might not be for your purpose), since you can use multiple fonts and materials per text object, you could have a material preset for each texture variation you want to use and using the <font="Font Asset Name" material="Material Preset Name"> you could switch to different materials in the same text object.
     
  47. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    I would be curious to know the contribution to compile time of TextMesh Pro alone? On my end, we are talking seconds to compile TMP.

    The DLL version on the Asset Store is what you are looking for with the exception of not being able to go back and forth between the dll version and the paid version due to the GUIDs being different. However, if you start a new project with the dll version all should be fine.

    Again, personally I would not switch to the dll version. Especially given Unity is also about to introduce Assembly Definitions which will give you control over script compilation.
     
  48. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    649
    Hey,

    I'm very sorry for wasting your time. It ended up being a SerializedObject which had too big of a data structure on it for a specific editor which was adding over 1minute of compile time for us ... it took me about 10 seconds to fix once I figured that out.

    In short: your scripts compile very fast and there's no need for a .dll to speed things up. Anyone who read this, please disregard and don't worry about it :).

    I did learn something though ... while the spinner in the bottom right is spinning, its compiling code. Once it stops spinning its doing other stuff. For us, the spinner would stop and then hang there for around a minute and a half.
     
    Stephan_B likes this.
  49. lenten1111

    lenten1111

    Joined:
    Jun 10, 2016
    Posts:
    8
    Hi Stephan_B, is there any way i can upgrade to new unity without updating Textmesh pro? Tried delete textmesh folder reimport still have same error. It just all texts cant be recognized, lose all instances.
     
  50. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Whenever you upgrade to a new version of Unity, you also need to update to a new version of TextMesh Pro. This is for the most part due to API changes from one version of Unity to the other and some other factors.

    Upgrading to a new version of TMP should not be an issue and it should have no impact on the project.

    As per the Release and Upgrade notes, before importing the new version of TMP, you must first remove the previous version by deleting the "TextMesh Pro" folder. Always back up your project first as well as any files you may have saved inside the TMP folder hierarchy. Be sure to review the TMP Settings file, Stlye sheet and sprite assets for any changes you may have made.

    Once the previous version has been removed, simply import the new and appropriate version of TMP for the new version of Unity you are using.

    The only extra consideration here is making sure that whatever version of TMP you were using. Meaning either the free version or paid version, that you stick to that same version as you can't go back and forth between paid and free or vice-a-versa.
     
Thread Status:
Not open for further replies.