Force Unity to scroll to the bottom of a scroll rect

So, I’ve got a textbox (TextMeshPro) with a load of text in it. As the game progresses, I add more text to the textbox and I want the user to see the bottom of the text (the last bit added)…

/// <summary>
/// Add text to the panel at the bottom of the screen
/// </summary>
public void AddTextToBottomPanel(string a_text)
  m_bottomPanelText.text += a_text;

IEnumerator PushToBottom()
  yield return new WaitForEndOfFrame();
  m_bottomScrollRect.verticalNormalizedPosition = 0;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: