Answer the question
In order to leave comments, you need to log in
How to programmatically slide the content of a ScrollView?
Hello.
It is necessary to make a smooth scrolling of the ScrollView content by clicking on the button.
Now it works like this
public void NavButtonDown_Click(){
StartCoroutine(ScrollToTop ());
}
public void NavButtonUp_Click(){
StartCoroutine(ScrollToBottom());
}
IEnumerator ScrollToTop ( )
{
yield return new WaitForEndOfFrame ( ) ;
Scrollview.GetComponent<ScrollRect>().verticalNormalizedPosition = 1f ;
}
IEnumerator ScrollToBottom ( )
{
yield return new WaitForEndOfFrame ( ) ;
Scrollview.GetComponent<ScrollRect>().verticalNormalizedPosition = 0f ;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question