Search Unity

Unity UI ScrollRect how to scroll all the text up till no text appeared in viewport?

Discussion in 'UGUI & TextMesh Pro' started by hsjaaa, Jun 28, 2019.

  1. hsjaaa

    hsjaaa

    Joined:
    Apr 30, 2016
    Posts:
    29
    Have a TextMeshPro UGUI inside a ScrollRect, want that before new text added to the TextMeshPro UGUI, scroll the text already in the TextMeshPro UGUI up till no text appeared in viewport, not use "\n", then add the new text and make the new text appear at the top of the ScrollRect. Is this possible or is there other way to do this? Thanks!
     
  2. Hosnkobf

    Hosnkobf

    Joined:
    Aug 23, 2016
    Posts:
    1,096
    It is all about the size of your content assigned to the scroll rect. Make it bigger than the text field and you can scroll further.

    You could achieve this with a layout group as ontent which contains the text as well as an empty object of a certain size.
    You could also use the BetterContentSizeFitter of Better UI (see my signature) to fit the content to the text but add padding to it.