Problems with dynamically adding and scrolling to Scrollview
Hi! Im trying to increase the capacity (space) in the content of my scrollview, so it can fit more elements than its default element capacity. Im doing the following code beneath, and everything is working well until I put this code for increasing the RectTransform of the content:
teamListContent.GetComponent().sizeDelta += new Vector2(0, teamScrollTransform.rect.height / 2 - 50);
I have two problems:
1) Whenever I have the above codeline, all buttons get messed up and is placed above each other etc. I am using some offset and other things which I experimented widldly with, that might cause the issue. Still I cant seem to find out how to fix this, I need to be able to resize the scroll view (content) so it can work dynamically.
2) Whenever I have "too" many elements in my current code (WITHOUT THE LINES ABOVE) I can see half an element beneath the end of my scrollview, and I can scroll there by draging and holding with force (not naturally swiping).
This is the entire code for filling my scroll view content and resizing:
Here's a video of my problem: https://vid.me/ht2V
Thanks a lot!