What does the “Is Scale Static” flag of the Text Mesh Pro object do? Should it be turned off only if the text is involved in a scaling animation or should it be turned off whenever I scale the text, even if I only do it rarely?
In order for the text to render correctly, scale information must be passed to the text object. Since there is no callback in Unity to track scale changes, text objects have to be checked each frame to see if their scale has changed.
As such, when you have a scene with lots of text objects (100’s, 1000’s) this does add performance overhead. In order to get around this overhead when the text objects will not be changing scale, I added this new property IsScaleStatic to remove them from being checked.
OK, thanks! But I’m not sure I understand: I see that I can still scale TextMesh Pro objects at run-time, even when Is Static Scale is turned on, with no delay. Maybe it only has an effect when using hundreds of objects?
Correct. You would only notice a potential impact when you have 100’s of text objects on mobile.
I’m confused He wrote:
If that’s still working, what’s the drawback of not enabling “Is Static Scale”?
When IsStaticScale is disabled, each text object gets a callback to check for potential scale change. As such when you have lots of text objects, this adds some performance overhead which is more noticeable on mobile.
Scaling the text objects with this enabled, can lead to overly sharp or soft text as the scale change increases.
Oh, so the scale changes properly, it’s just that the distance field algo isn’t aware of the changes so it might look “wrong”?
(so for say small scale changes, like a text bounces 10% up and down of it’s normal value, even with “Is scale static” it might be more or less okay?)
Correcto
Small changes should be fine but you should test it out. Text might get a bit softer / sharper but if it is done as part of an animation it might not be noticeable either. You just need to make sure the text object is updated at the end of the animation so it gets the correct SDF scale.
The above could be achieved by using ForceMeshUpdate() once the animation is done.
Noob question here, how does this work with Canvas scaler? If I use TextMeshProUGUI in canvas with CanvasScaler component, should I left it unticked or it doesn’t matter at all?
The Canvas Scaler does affect scaling where as such, if the SDF Scale of the objects is not updated and if the scale change was significant enough it would cause the text objects to render either too soft or too sharp.
If you have a way of knowing when the Canvas Scaler affected the scale of the canvas and objects, then you could manually force an update on those text objects using ForceMeshUpdate(). Normally the Canvas Scaler will do it thing when the scene is loaded, screen resolution changed, and device rotated from landscape to portrait mode, etc.
ForceMeshUpdate() - This is exactly what I was hoping to find when I came across this thread. I didn’t want to include thousands of objects in the internal update when scaling is fairly rare. Now I can trigger only when needed. Thanks!