Make Scrollview scroll down when new text is added
So, I want to replicate a chat program in my game. For this I am using a ScrollView with a vertical layout group and a content size fitter to put instantiated text prefabs below one another. What I need is the ScrollView to scroll completely down (aka value 0) every time a new text child is added to the content. So far I have tried to set the value to 0 in multiple ways, for example by setting it to 0 upon instantiating the text. However, this doesnt work as there is always one new text that it overlooks. Upon creating a new text in this not-quite-at-0 state, however, it scrolls down to where the former text would have been. It appears that the text is ordererd in after I set the value, despite the value being set when the text is made.
My question is if there is a way to make the scrolling the last operation after all the stuff with the adding and ordering has been done. If you know another way, dont hesitate either :)
Answer by lixyna · Apr 28, 2018 at 10:49 AM
Sadly, I didnt quite get what I wanted done, but at least I managed to make a workaround. I turned every function in my script that scrolled into an IEnumerator and waited for the current frame to end to do the scrolling. Works just fine in most instances.
Your answer

Follow this Question
Related Questions
TextUI text changes size if resolution changes 1 Answer
How to draw text in a non-rectangular area 0 Answers
Using Japanese in my game 1 Answer
TextMeshPro Set Alpha Color 0 Answers