2
\$\begingroup\$

What does this Yellow Outline Represent around Text Mesh Pro Text objects in Unity? I don't see any regarding them in the inspector making it so that I have eye-ball it in the scene view to make it smaller. But it's caused me nothing but trouble such as causing overlap issues with other Text Mesh Pro Text objects making only the most recently rendered button usable. What is it? And how do I modify it's values and/or make it go away?

enter image description here

\$\endgroup\$
4
\$\begingroup\$

These are 'margins'. In the inspector, you can find them under the 'extra settings' section. This is what the documentation says about them:

The Margins values can be used to add some space between the text and the content bounds. You can also use negative margins, in which case the text can extend beyond the bounds of the container. You can also adjust the margins by dragging the handles of the yellow rectangle in the scene view.

You can find the settings here in the inspector: (visually, the 'Extra Settings' dropdown changed in a recent version of Unity. In older versions of textmesh pro, the 'Extra Settings' looked more like a button as in the linked documentation)

The inspector winddow

As for where you can use it for... Well, for most cases I think nesting them inside other RectTransforms and handling margins using RectTransforms works just as good and is more intuitive.

So far the only real use I found is when used in layout groups, where the layout groups control the text RectTransform size (Based on that text layout properties, and sinse the margins affect the preferred width/height layout properties, you can then easier apply margins for individual text components). But there might be many more use-cases that I don't know about.

If you really wan't to disable these gizmo's, you can. Note however that this will disable all gizmos of Textmesh pro (I'm not sure whether there are any others, but I'll add this warning in case I missed some), so I'd advise to simply leave the margins at 0 and ignore them. To disable, above the shene view, click the 'gizmos' drowpdown arrow. The under Scrips, uncheck 'TextMeshProUGUI' or 'TextMeshPro' depending on which one you use (You can re-check it later if you want them back).

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Very well explained answer, But i think it will be even better if you add link to the documentation... \$\endgroup\$ – Swati Sep 27 '19 at 11:31
  • \$\begingroup\$ I did in the first sentence of my answer (The 'the documentation' part before the quote is a link). Do you mean different documentation, or is there some better way how I should include links into my answer? \$\endgroup\$ – troien Sep 27 '19 at 12:26
2
\$\begingroup\$

It's like a bounding box for the text.

enter image description here

If you narrow it the text will overflow,

enter image description here

And here in the settings you can change what happens (like text going into a new line or creating dots ex ...)

enter image description here

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.