Scroll View

Objective


Create infinite (dynamic) Scroll view in Unity.


Scroll View


Scroll Rect component is one of the objects of the main game

The viewport has a mask component. The viewport can either be the main game object or a separate game object whose child inherits the main. If you are using for auto-hiding scrollbars it must be a child. The viewport Rect Transform needs to be referenced in the Viewport property of the Scroll Rect.

When we need to manage big data on a small screen, then  Scroll View is the best choice.


A Large Amount of Data can’t be managed in a small display, one of the solutions to this issue in Unity is Scroll View. Scroll View provides smooth scrolling to select a data to integrate a Scroll View in Unity steps are explained below.

The Main elements in a scroll view are the viewport, the scrolling content, and optionally one or two scrollbars.

Scroll Rect component is one of the objects of the main game

The viewport has a mask component. The viewport can either be the main game object or a separate game object whose child inherits the main. If you are using for auto-hiding scrollbars it must be a child. The viewport Rect Transform needs to be referenced in the Viewport property of the Scroll Rect.
All the scrolling element must be children of a single element of the game object that is a child to the viewport. The element  Rect Transform needs to be referenced in the Content property of the Scroll Rect.


The scrollbars - if used - our children to the main  GameObject. See the Scrollbar page for more details on the setup of a scrollbar and see the section Scrollbar setup below for information about the setup of scrollbars with a scroll view.


Content Size Fitter


The Content Size Fitter is a layout manager that manages the size of its own layout element. The size is determined by the minimum or preferred sizes provided by layout element components on the Game Object.


it’s worth keeping in mind that when a Rect Transform is Re Change  - whether by a Content Size Fitter or something else - the resizing is around the pivot.


Layout Element


If you want to put the minimum, preferred, or flexible size of a layout element, they can use a Layout Element component to the Game Object.


The   functionality Can be used for proper Manner,
First minimum sizes are allocated.


If there is sufficient available space, preferred sizes are allocated.
If there is additional available space, flexible size is allocated.


Mask


A Mask is not a visible UI control but rather a way to minor change the appearance of Manage child elements. The mask restricts the child elements to the shape of the parent. So, if the child is big compared to the parent then only the part of the child that fits within the parent will be visible.


Anchors


Rect Transforms accommodate layout concept called anchors. Anchors are shown as four small triangular handles in the Scene View and anchor information is also shown in the Inspector. For example, the child can be anchored to the center of the parent, or to one of the corner. If the parent of a Rect Transform is also a Rect Transform, the child Rect Transform can be anchored to the parent Rect Transform in various ways.