Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Layout Elements and Text

Discussion in 'UGUI & TextMesh Pro' started by Havie, Sep 4, 2022.

  1. Havie

    Havie

    Joined:
    Oct 12, 2019
    Posts:
    89
    Hello All,

    Time and Time again I am stumped on how to properly use Layout Elements and Content size fitters with Text mesh Pro.

    Setup:
    1- I have text as a child of a 64x32 Image. I want the text to stay inside of those bounds (some padding would be nice)
    2- Text mesh pro is set to Wrapping Disabled
    3- Added Layout element to text and set preferred width to 64 and height to 32.
    4-Added a context size fitter to text and set preferred for both with and height.

    Result:
    Text is completely outside of the bounds

    upload_2022-9-4_11-11-38.png

    Any ideas why? Perhaps the font asset itself is setup wrong

    Using the default font its much closer
    upload_2022-9-4_11-13-6.png