unity scroll view component code example
Example: unity dynamic scrollview
1. Create a scroll view (right click > UI > Scroll View)
2. Select Content, add Content Size Fitter component.
3. Change the settings of Content Size Fitter to Prefered Size