{"id":5753,"date":"2024-02-02T23:32:21","date_gmt":"2024-02-02T21:32:21","guid":{"rendered":"https:\/\/unitycoder.com\/blog\/?p=5753"},"modified":"2024-02-02T23:32:21","modified_gmt":"2024-02-02T21:32:21","slug":"ui-make-tooltip-background-fit-text-content-length","status":"publish","type":"post","link":"https:\/\/unitycoder.com\/blog\/2024\/02\/02\/ui-make-tooltip-background-fit-text-content-length\/","title":{"rendered":"UI: Make Tooltip background fit Text content length"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2024\/02\/image.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"762\" data-attachment-id=\"5754\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2024\/02\/02\/ui-make-tooltip-background-fit-text-content-length\/image-39\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2024\/02\/image.png?fit=1401%2C1043&amp;ssl=1\" data-orig-size=\"1401,1043\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2024\/02\/image.png?fit=1024%2C762&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2024\/02\/image.png?resize=1024%2C762&#038;ssl=1\" alt=\"\" class=\"wp-image-5754\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2024\/02\/image.png?resize=1024%2C762&amp;ssl=1 1024w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2024\/02\/image.png?resize=300%2C223&amp;ssl=1 300w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2024\/02\/image.png?resize=768%2C572&amp;ssl=1 768w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2024\/02\/image.png?w=1401&amp;ssl=1 1401w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/a><\/figure>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Add UI\/Panel as background<\/li>\n\n\n\n<li>Set pivot to Top Left<\/li>\n\n\n\n<li>Add Text as Child of the Panel<\/li>\n\n\n\n<li>Add Content Size Fitter to Panel<\/li>\n\n\n\n<li>Add Horizontal Layout Group to Panel (Enable: Control Child Size: [x] Width, [x] Height, Child Force Expand: [x] Width, [x] Height)<\/li>\n\n\n\n<li>Content size fitter: Horizontal Fit: Preferred Size, Vertical Fit: Unconstrained (if you want 1 line only) or Preferred Size for multiline)<\/li>\n\n\n\n<li>Set some text value to child text component, Panel should resize to it<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/5QWarlFrL0w?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/span>\n<\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":5754,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":false,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1160,3],"tags":[854,1274,1273,1275,1161,806,1276,650],"class_list":["post-5753","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ui","category-unity3d","tag-content","tag-fit","tag-fitter","tag-responsive","tag-size","tag-text","tag-tooltip","tag-ui"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2024\/02\/image.png?fit=1401%2C1043&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1KTaT-1uN","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/5753","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/comments?post=5753"}],"version-history":[{"count":1,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/5753\/revisions"}],"predecessor-version":[{"id":5755,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/5753\/revisions\/5755"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media\/5754"}],"wp:attachment":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media?parent=5753"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/categories?post=5753"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/tags?post=5753"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}