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

Question Dynamically adding elements to ScrollRect

Discussion in 'UGUI & TextMesh Pro' started by mechaniqe, Aug 3, 2020.

  1. mechaniqe

    mechaniqe

    Joined:
    Jan 25, 2017
    Posts:
    18
    I am dynamically loading elements to a ScrollRect (as you scroll towards the end new items are loaded and then added). I have a ContentSizeFitter on the Content gameObject and everything works properly, except for a single problem:
    The scrollbar position (due to newly added elements) is only updated during scrolling.

    If you hit the bottom of the list, new items are added below, but the scrollbar stays at the bottom, so the user/player is unaware about the new content until he/she tries scrolling up the list.

    So the question is:
    Is there a way to tell these components (ScrollRect or Scrollbar) to update themselves? Any way to SetDirty?
     
  2. mechaniqe

    mechaniqe

    Joined:
    Jan 25, 2017
    Posts:
    18