Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question ContentSizeFitter - Forcing minimum size?

Discussion in 'UGUI & TextMesh Pro' started by lcompton, Jan 12, 2024.

  1. lcompton

    lcompton

    Joined:
    Mar 31, 2018
    Posts:
    108
    I'm developing a simple tooltip component. The structure is as follows...
    • Panel - Image, ContentSizeFitter, HorizontalLayoutGroup
      • TMP Text
    Here are the panel settings...
    ContentSizeFitter.jpg

    The panel properly resizes horizontally as the text length increases.

    The problem I'm having is that the ContentSizeFitter appears to be forcing the panel's initial width to 128 pixels. The panel does get wider when the text is greater than 128 pixels, but it doesn't scale down to fit shorter text.

    When I set "Horizontal Fit" to "Unconstrained", set the width to 30, and then set "Horizontal Fit" to "Preferred Size" again the panel size is set back to 128.

    I need the panel size to be smaller initially. Any suggestions?
     
    Last edited: May 8, 2024
  2. bakervr

    bakervr

    Joined:
    Jul 12, 2017
    Posts:
    2
    Did you ever figure this out? Having the exact same problem.
     
  3. lcompton

    lcompton

    Joined:
    Mar 31, 2018
    Posts:
    108
    No. I'm just living with it for now. Annoying little problem.