Feb
2
2024

UI: Make Tooltip background fit Text content length

  1. Add UI/Panel as background
  2. Set pivot to Top Left
  3. Add Text as Child of the Panel
  4. Add Content Size Fitter to Panel
  5. Add Horizontal Layout Group to Panel (Enable: Control Child Size: [x] Width, [x] Height, Child Force Expand: [x] Width, [x] Height)
  6. Content size fitter: Horizontal Fit: Preferred Size, Vertical Fit: Unconstrained (if you want 1 line only) or Preferred Size for multiline)
  7. Set some text value to child text component, Panel should resize to it

Leave a comment

Connect

Twitter View LinkedIn profile Youtube Youtube Join Discord Twitch Instagram

UnityLauncherPro

Get UnityLauncherPRO and work faster with Unity Projects!
*free unity hub alternative

@unitycoder_com

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.