Search Unity

TextMesh Pro How to make Curve Text By Using TextMesh Pro?

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by ingle, Feb 20, 2019.

  1. ingle

    ingle

    Joined:
    Jun 26, 2018
    Posts:
    1
    Any suggestion will be appreciate.
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    There are several posts about this already on the forum.

    I also added a new example in the TMP Examples & Extras included with version 1.4.0-preview.xx of TextMesh Pro for Unity 2018.3. The example scene is called "25 - Sunny Days Example".

    upload_2019-2-19_20-9-48.png
     
  3. zenasprime

    zenasprime

    Joined:
    Mar 31, 2010
    Posts:
    40
    I don't see this example scene. 25 is currently called TextMeshPro Title.
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    This new example is part of the update TMP Examples & Extras included in version 1.4.0 of TMP for Unity 2018.3 or newer.
     
  5. zenasprime

    zenasprime

    Joined:
    Mar 31, 2010
    Posts:
    40
    I'm using Unity 2018.3.5, which lists 1.3.0 as the current stable version. I've updated to 1.4.0 so that first hurdle has been solved.

    My next issue is that this solution seems to only be useful for applying a curve at run time. It doesn't provide any means to apply the curve in the editor so that it can complement existing UI elements. Any suggestions?
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    This script was provided to give users some insight on how the vertex attributes of the underlying text object could be modified to achieve various FX.

    I would suggest creating your own script and using this example as a basis. To make the script work in the editor, you can use the [ExecuteAlways] attribute.

    One thing you will have to be mindful of is these modifications of the vertex attributes / geometry being reset anytime the text changes. Ie. the text component will re-layout the text normally when it is changed. Then this script need to subsequently modify it back to curve it.

    Also look at the VertexJitter.cs script ... you should be able to attach to the TEXT_CHANGED_EVENT to detect the re-layout and re-apply your modification.
     
  7. zenasprime

    zenasprime

    Joined:
    Mar 31, 2010
    Posts:
    40
    Well, to be honest, the only reason I'm using a TextMeshProUGUI at all is because the string is going to be constantly changing value. Otherwise I'd just make the text a sprite (or part of a larger sprite) and be done with it. ;)

    Maybe one day Unity will give us the same design tools for text as say Illustrator. (hint hint)

    Until then I'll take a look at the scripts above, but the last thing I'm interested in doing when trying to implement a UI design is write custom code for the pretty standard text treatments I get from the graphic designer. It's hard to have this conversation with the designer, that their design poses some custom problem solving issues when the tools they are using are fairly simple for them to use (all the while their giving you squinty eyes for why it's not so easy in Unity) while at the same time development resources have budget and deadline considerations to keep in mind. *sigh*
     
  8. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    Certainly understandable and thank you for the feedback.

    Adding additional design / layout tools for the text would certainly be a good thing. I don't have the time right now to look / work on this so this could be an opportunity for some Asset Store developers to provide to users.
     
  9. manawindgames

    manawindgames

    Joined:
    May 27, 2018
    Posts:
    1
    hi, I'm having trouble getting the curved text to stay curved when I change it.

    Even with a simple test -

    TextMeshProUGUI t;
    t.text = "New text";

    where I assign the Sunny Days example scene text object to t then change it - so when it loads with "Sunny Days" text it's curved, after a delay when it changes to "New text" it becomes straight.

    Is there some trick to keeping the curve after updating the text?