Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: jchristof on June 20, 2013, 01:04:21 PM

Title: Label inside a scroll panel. Updated text isn't positioned to top
Post by: jchristof on June 20, 2013, 01:04:21 PM
Are there steps I can take to reset the text and scroll bar both to the top if new text is applied to the label?

Thanks!
Title: Re: Label inside a scroll panel. Updated text isn't positioned to top
Post by: ArenMook on June 20, 2013, 01:38:02 PM
Automatically? No. Manually? Sure. When you set your text's label, also reset the scroll bar's position.
Title: Re: Label inside a scroll panel. Updated text isn't positioned to top
Post by: jchristof on June 20, 2013, 06:18:33 PM
Right, I guess I was looking for an alternative to this which doesn't seem to position new text to the top of the scroll panel:
  1. GameObject.Find("Label inside the scroll panel").GetComponent<UILabel>().text = Text.getText(text);
  2. GameObject.Find("ScrollBar").GetComponent<UIScrollBar>().scrollValue = 0;
  3. GameObject.Find("ScrollBar").GetComponent<UIScrollBar>().ForceUpdate();

But grabbing and pulling the scrollbar works as expected.