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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Resize parent to text in one direction

Discussion in 'UGUI & TextMesh Pro' started by Thaxxel, Jul 11, 2017.

  1. Thaxxel

    Thaxxel

    Joined:
    Jan 14, 2014
    Posts:
    8
    [SOLVED]

    Hello All,

    I am currently using the Content Size Fitter and Vertical Layout Group to resize a UI image to properly fit the amount of text inside that image dynamically. However, I notice that this results in the UI image resizing both in the positive and negative y axis. Moving the image both up and down to fit the text. However, I am looking to have the box only expand in the "up" , positive y, direction to resize to fit the child text component.

    Has anyone ever done this before or have a solution?

    Thanks!
     
    Last edited: Jul 12, 2017
  2. Thaxxel

    Thaxxel

    Joined:
    Jan 14, 2014
    Posts:
    8
    Solved my problem. All I had to do was adjust the location of the pivot on my Parent object to have it rescale/expand in one direction!
     
    D3o, alikun, mathmoe64 and 1 other person like this.
  3. bello89808m

    bello89808m

    Joined:
    Aug 12, 2022
    Posts:
    1
    holy S*** it actually works
     
  4. Unifikation

    Unifikation

    Joined:
    Jan 4, 2023
    Posts:
    1,062
    Can you explain how you did this?

    I'm not following the original post's meanings.