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. Dismiss Notice

ScrollView

Discussion in 'Scripting' started by kabuto178, May 26, 2017.

  1. kabuto178

    kabuto178

    Joined:
    Mar 21, 2017
    Posts:
    59
    I am using Unity 5.6 and trying to get a vertical list of Text elements in a scrollview content object, however the text components when added dynamically all just appear in the center of the content component of the scrollview, how can i get the text components to appear starting at the laft hand side of the content object?
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Try adding a vertical layout component to the 'Content' portion of the scrollview. When you add the text elements, they should appear one after the other. The default alignment is top left to start, and you can modify the spacing, padding, etc.. for more control :)
     
  3. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,144
    Also add a content size fitter to the "content" so the content rect expands or shrinks based on how many objects you add to it.
     
  4. kabuto178

    kabuto178

    Joined:
    Mar 21, 2017
    Posts:
    59
    Thanks for both comments, I actually needed content size fitter as well as my system was breaking.
     
  5. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Glad you got it solved. When I saw the comment about the size fitter, I thought it was good, too :)