You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements its own infinite scrolling method and additional events for when pages change.
37
37
@@ -57,7 +57,7 @@ Property | Description
57
57
*Mask Area*|Maskable area for control, pages outside this area will be made inactive. Used in conjunction with the Mask Buffer. Recommended to also add a RectMask2D to MaskArea GO.
58
58
*Mask Buffer*|The amount of page buffer to surround the Mask Area and control which pages are active / inactive. Lower value equals more active pages.
59
59
*Jump On Enable*|By default the container will lerp to the start when enabled in the scene, this option overrides this and forces it to simply jump without lerping
60
-
*Restart On Enable*|By default the container will return to the original starting page when enabled, this option overrides this behaviour and stays on the current selection
60
+
*Restart On Enable*|By default the container will stay on the current selection, this option overrides this behaviour and returns to the original starting page when enabled.
61
61
*Use Parent Transform*|When using prefabs in the ChildObjects array, the control with use the prefab transform values instead of resetting to the parent.
62
62
*Child Objects*|An array of prefabs to load the control with. Can EITHER add children in to the scene or via this array but NOT both.
63
63
***On Selection Change Start*** (event) |The Event fired when the user starts changing the page via swipe or mouse
@@ -72,6 +72,21 @@ CurrentPage|int|The current snapped page, or selected page as the user swipes
72
72
73
73
---------
74
74
75
+
## Methods
76
+
77
+
Method | Arguments | Description
78
+
|-|-|-|
79
+
*DistributePages*|N/A|Forces a refresh of the currently available Scroll Snap Pages
80
+
*Add Child*|Go (GameObject)|Add a new child to this Scroll Snap and recalculate its children
81
+
*Add Child*|Go (GameObject), WorldPositionStays (bool)|Add a new child to this Scroll Snap and recalculate its children, and resets the world position of the new child.
82
+
*Remove Child*|index (int), (out) ChildRemoved (GameObject)|Remove a new child to this Scroll Snap and recalculate its children, outputs the removed object to a variable.
83
+
*Remove Child*|index (int), WorldPositionStays (bool), (out) ChildRemoved (GameObject)|Remove a new child to this Scroll Snap and recalculate its children, outputs the removed object to a variable. Resets the world position of the removed GameObject.
84
+
*RemoveAllChildren*|(out) ChildrenRemoved (GameObject[])|Remove all children from this ScrollSnap, outputs a GameObject array of all removed children.
85
+
*RemoveAllChildren*|WorldPositionStays (bool), (out) ChildrenRemoved (GameObject[])|Remove all children from this ScrollSnap, outputs a GameObject array of all removed children. Resets the world position for all removed children.
86
+
*UpdateLayout*|N/A|Used for changing / updating between screen resolutions
87
+
88
+
---------
89
+
75
90
## Usage
76
91
77
92
Like with other Layout controls, simply add this to the parent RectTransform for a collection of child elements through the Add Component menu as follows:
Copy file name to clipboardExpand all lines: Controls/ScrollSnap.md
+33-3Lines changed: 33 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,6 @@
1
1
# ScrollSnap
2
2
3
-
An alternate scroll snap control supporting both Horizontal and Vertial layous in one control
4
-
5
-
<!---->
3
+
An alternate scroll snap control supporting both Horizontal and Vertical layouts in one control
6
4
7
5
---------
8
6
@@ -35,6 +33,38 @@ Pages can be moved by keys, swipes or via the use of buttons.
35
33
36
34
---------
37
35
36
+
## Properties
37
+
38
+
The properties of the Horizontal Scroll Snap control are as follows:
39
+
40
+
Property | Description
41
+
|-|-|
42
+
*Next Button*|Optional button to move the ScrollSnap forward.
43
+
*Prev Button*|Optional button to move the ScrollSnap backward.
44
+
*Items Visible at once*|How many items should be visible at the same time.
45
+
*Auto Layout Items*|Should the ScrollSnap contents be automatically aligned, or left untouched.
46
+
*Link Scrollbar Steps*|Use the base ScrollRect steps configuration for the ScrollSnap.
47
+
*Link Scrollbar Scroll Sensitivity*|Use the base ScrollRect scroll sensitivity configuration for the ScrollSnap.
48
+
*Use Fast Swipe*|Should "Fast Swipe" be used to progress pages.
49
+
*Fast Swipe Threshold*|The speed of the ScrollSnap is moving before a "Fast Swipe" motion is detected.
50
+
*Direction*|The direction the ScrollSnap flows in, Horizontal or Vertical.
51
+
***On Page Change*** (event) |The Event fired when the current page changes, either via swipe, mouse, Next/Prev Buttons
52
+
53
+
---------
54
+
55
+
## Methods
56
+
57
+
Method | Arguments | Description
58
+
|-|-|-|
59
+
*ChangePage*|Index (int)|Move the ScrollSNap to a specific page (0 indexed)
60
+
*CurrentPage*|None|Returns the Current Page selected for the ScrollSnap
61
+
*NextScreen*|None|Forces the control to move to the "Next" page
62
+
*PreviousScreen*|None|Forces the control to move to the "Previous" page
63
+
*ResetPage*|None|Resets the currently selected page to the starting page, usually page 0
64
+
*SetLerp*|value (bool)|Enable or disable smooth Lerp movement
65
+
66
+
---------
67
+
38
68
## Usage
39
69
40
70
Like with other Layout controls, simply add this to the parent RectTransform for a collection of child elements through the Add Component menu as follows:
Now also supports infinite scrolling and additional events for when pages change.
37
37
@@ -57,7 +57,7 @@ Property | Description
57
57
*Mask Area*|Maskable area for control, pages outside this area will be made inactive. Used in conjunction with the Mask Buffer. Recommended to also add a RectMask2D to MaskArea GO.
58
58
*Mask Buffer*|The amount of page buffer to surround the Mask Area and control which pages are active / inactive. Lower value equals more active pages.
59
59
*Jump On Enable*|By default the container will lerp to the start when enabled in the scene, this option overrides this and forces it to simply jump without lerping
60
-
*Restart On Enable*|By default the container will return to the original starting page when enabled, this option overrides this behaviour and stays on the current selection
60
+
*Restart On Enable*|By default the container will stay on the current selection, this option overrides this behaviour and returns to the original starting page when enabled.
61
61
*Use Parent Transform*|When using prefabs in the ChildObjects array, the control with use the prefab transform values instead of resetting to the parent.
62
62
*Child Objects*|An array of prefabs to load the control with. Can EITHER add children in to the scene or via this array but NOT both.
63
63
*On Selection Change Start* (event) |The Event fired when the user starts changing the page via swipe or mouse
@@ -72,6 +72,21 @@ CurrentPage|int|The current snapped page, or selected page as the user swipes
72
72
73
73
---------
74
74
75
+
## Methods
76
+
77
+
Method | Arguments | Description
78
+
|-|-|-|
79
+
*DistributePages*|N/A|Forces a refresh of the currently available Scroll Snap Pages
80
+
*Add Child*|Go (GameObject)|Add a new child to this Scroll Snap and recalculate its children
81
+
*Add Child*|Go (GameObject), WorldPositionStays (bool)|Add a new child to this Scroll Snap and recalculate its children, and resets the world position of the new child.
82
+
*Remove Child*|index (int), (out) ChildRemoved (GameObject)|Remove a new child to this Scroll Snap and recalculate its children, outputs the removed object to a variable.
83
+
*Remove Child*|index (int), WorldPositionStays (bool), (out) ChildRemoved (GameObject)|Remove a new child to this Scroll Snap and recalculate its children, outputs the removed object to a variable. Resets the world position of the removed GameObject.
84
+
*RemoveAllChildren*|(out) ChildrenRemoved (GameObject[])|Remove all children from this ScrollSnap, outputs a GameObject array of all removed children.
85
+
*RemoveAllChildren*|WorldPositionStays (bool), (out) ChildrenRemoved (GameObject[])|Remove all children from this ScrollSnap, outputs a GameObject array of all removed children. Resets the world position for all removed children.
86
+
*UpdateLayout*|N/A|Used for changing / updating between screen resolutions
87
+
88
+
---------
89
+
75
90
## Usage
76
91
77
92
Like with other Layout controls, simply add this to the parent RectTransform for a collection of child elements through the Add Component menu as follows:
0 commit comments