How to make Curve Text By Using TextMesh Pro?

Any suggestion will be appreciate.

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

3 Likes

I don’t see this example scene. 25 is currently called TextMeshPro Title.

1 Like

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.

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?

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.

3 Likes

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. :wink:

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

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.

1 Like

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?

Example doesn’t work to me. Rather I can’t see anything but the hierarchy structure.

  • Scene is empty — visually.
  • TMP Submesh UI script has None both in Font Asset and in Sprite Asset.
  • After play, IndexOutOfRangeException appears out.

I just created a project (Unity 2019.2.0f1) and import TMP Examples.

In this same new project, first make sure you import the TMP Essential Resources and then the TMP Examples & Extras. Then load the Sunny Days example.

1 Like

For whoever may be interested, I had to create a text that followed a circle, so I had to bang my head to modify the WarpTextExample… but in the end, I obtained something that worked decently!

To help other devs in the community in the same situation, I have created a repo with my scripts. I have also filled them with comments so that they are easier to understand. Feel free to use them in your projects!

https://github.com/TonyViT/CurvedTextMeshPro

Have fun

13 Likes

Hey, this is neat. I was about to dive into writing a similar helper, but then I found this thread and your post. It worked nicely and saved me probably several hours of work. Thanks! =)

@TonyVT Thanks so much for this! Your demo scene works beautifully, but it doesn’t work when I try to use your game object in my own scene. if I try to scale the game object all the fonts seem to overlap each other into one black mess. :sweat_smile:

I just wanted to curve some text. Not sure if there’s an easy solution for this today, but I came across this post and your script worked like a charm! Thank You!

Straightforward to use and works! nice!

@TonyVT , thanks a lot for sharing your code! It works great and it is just what I was looking for. However, I think the ParametersHaveChanged() method is redundant. I removed it and used OnValidate() instead:

        private void OnValidate()
        {
            m_forceUpdate = true;
        }

Thanks for this fantastic tool!

One question: I would like to curve the text and apply a simple scaling tween (using DoTween in my case) per character. The problem I’m facing is that as soon as the tween starts, the curve of the text is lost. Any ideas on how I can apply a per-character animation without losing the curve?

EDIT: I’ve researched a bit more, and the reason seems to be a call to ForceMeshUpdate(true) before applying the tween. If I comment that line out, the tween is applied correctly to the curved text. I’ll contact the Dotween’s developer to explain the situation and see if it’s reasonable to call that line with a flag.

Hi, @Stephan_B , I was just wondering if any of the later versions of TextMeshPro still has this “Text along a curve” feature?

Be nice to have the text swell/distort away from the line, on the outer part of curves, and do the inverse on the inner part of curves, too.

Please.

1 Like