Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    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:
    88
    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