MassivePickerScrollRect

This is a class that manages 1 column (or 1 row) of MassivePicker. Handles control of items and scrolls.It inherits UnityEngine.ScrollRect and has equivalent functionality.

Function to update the item

Name

Description

UpdateItemContent( int itemIndex )

Update the contents of the specified item.
Call massivePickerItem.SetItemContents().

UpdateAllItemContent()

Update the contents of all items in the visible range.
Call massivePickerItem.SetItemContents().
Function to get the selected item

Name

Description

GetSelectedPickerItem()

Returns the MassivePickerItem attached to the currently selected item.It is a functional version of selectedPickerItem.

selectedPickerItem

MassivePickerItem attached to the currently selected item.This is the property version of GetSelectedPickerItem().

GetSelectedItem()

Returns the GameObject of the currently selected item. It is a functional version of selectedItem.

selectedItem

GameObject of the currently selected item. Property version of GetSelectedItem().

Scroll function

Name

Description

ScrollToItemAtIndex( int index, bool immdiate = false )

Scroll to the index th item. When immdiate is true, scrolling is instantaneous.

ScrollTo( MassivePickerItem item, bool immdiate = false )

Scroll to item. When immdiate is true, scrolling is instantaneous.

ScrollTo( float offset, bool immdiate = false )

Scroll to position offset.
Offset is PickerItem.position, GetScrollPosition (), firstItemPosition Can be obtained from etc.

ScrollToNearItem( bool immdiate = false )

Scroll to the nearest item. When immdiate is true, scrolling is instantaneous.

Function to get the state

Name

Description

itemCount

Number of items the picker has.

GetScrollPosition()

Get current scroll position.

firstItemPosition

Get the scroll position of the first item.

lastItemPosition

Gets the scroll position of the last item.

infiniteScroll

Get enable or disable of infinite scroll.

GetNearItemIndex()

Get the index of the nearest item.

windowSize

Gets the size of the area to display the item.

Event

Name

Description

onSelectItem

This is an event sent when an item is selected.
You can change the send timing with whenToSendEvents.
For more information about events, please see https://docs.unity3d.com/Manual/UnityEvents.html .

Note

Events are sent from LateUpdate().
Function to get or set the value

Name

Description

itemSize

Size of the item.

itemCount

Number of items.

deactiveItemOnAwake

It is a flag to set calling SetActive (false) to ItemSource on Awake().
If the Item Source is an object placed on the scene,
you can make the object invisible by setting this flag to true.
It is not necessary to set this flag if the Item Source is prefab on Resources.

itemSource

GameObject from which to copy the item.
Component that inherits MassivePickerItem must be attached.
If deactiveItemOnAwake is set, this object’s SetActive(false) will be called.

layout

Get or set the scroll direction.
You can get / set any of RectTransform.Axis.Horizontal, RectTransform.Axis.Vertical.

autoScrollSeconds

When you tap an item, it takes time to scroll to that item.

slipVelocityRate

Stop the slip and scroll to the nearest item if the speed falls below this percentage.

wheelEffect

Reproduces the visual effect of placing the item on the wheel. Reduce the size of the item according to the distance from the center of the Column.

wheelPerspective

Set the depth of the wheel effect.

movementType

The behavior when content moves beyond the scroll rectangle.
Unrestricted: Loop infinitely.
Elastic: It behaves like elasticity.
Clamped: Stop.

initialPosition

Set the initial state of the scroll.

whenToSendEvents

When to send an event.
Always: Always send an OnSelectItem event whenever an item changes.
OnlyScrollStops: Sends an OnSelectItem event only when items have changed and scrolling has stopped.

enabledMouseControl

Get or set control with mouse/finger.

Note

The above values can also be set from the inspector.
Also, the behavior of some parameters can be confirmed in the demo below.
Assets/PickerForUGUI/Demo/ParameterDemo.unity