How to: Dynamic Scroll View in Unity

Uploaded by samyam
Share: Twitter Facebook
? Get the FULL Source Code ?
https://www.patreon.com/posts/69275327

? Support Me ?
Patreon: https://www.patreon.com/samyg
Donate: https://ko-fi.com/samyam

Learn how to make a dynamically sized scroll view UI in Unity Canvas easily. First we need to add a scroll view to our scene, then under the Content gameobject you can add your item prefabs that will be in your scrollview. To make it dynamically resize the content of the Rect Transform based on the number of items, you either add a Horizontal Layout Group or a Vertical Layout Group to the Content Gameobject along with a Content Fitter component set to Preferred setting. Then to dynamically load objects in through code you can get a reference to your prefab, the list of items or images you want to spawn, loop over them and spawn them under the Content transform, and do other processing.

►? Relevant Video Links ?
►Kenney UI Pack: Space Expansion
https://www.kenney.nl/assets/ui-pack-space-expansion
►Kenney Pixel Shmup
https://www.kenney.nl/assets/pixel-shmup

►⏱️ Timestamps ⏱️
0:00 Intro
0:05 Set up ScrollView
1:42 Horizontal Layout Group
3:53 Content Fitter
5:48 Dynamically Add Items Through Code
10:31 IPointerClickHandler
11:19 Outro

??THANK YOU TO ALL MY PATRONS ??

❯❯❯ My Links ❮❮❮
? Patreon ?
https://www.patreon.com/samyg
? Discord Server ?
https://discord.gg/SwCKB3Q
? Twitter ?
https://twitter.com/samyam_utube
? Facebook ?
https://www.facebook.com/samyam.youtube/

? Like and Subscribe! ?

?️ Computer Setup ?️
*As an Amazon Associate I earn from qualifying purchases.
https://www.amazon.com/shop/samyam

#unity3d #unitytutorial #gamedevelopment