Massive Picker
It’s a picker that improves performance by recycling items that go out of screen.
There is a disadvantage that the size of the item is fixed. Instead, it can handle a large number of items.
This page describes the structure of MassivePicker using MassiveVerticalPicker as an example.
MassiveVerticalPicker can be added by clicking [GameObject]/[UI]/[Picker]/[Massive Vertical Picker] in menu.
This page does not describe objects similar to Picker.
MassiveVerticalPicker
The root object.
Column
The body of the column. Duplicate this object (Ctrl + D) to place multiple columns.
MassivePickerScrollRect component is attached.
MassivePickerScrollRect Component Setting Items
Many items are the same as Picker .This page describes only the MassivePickerScrollRect specifics.
Name |
Description |
---|---|
Deactive Item On Awake |
This is a flag that sets calling SetActive (false) on an object set 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.
|
Item Source |
GameObject from which to copy the item.
Component that inherits MassivePickerItem must be attached.
If Deactive Item On Awake is set, this object’s SetActive(false) will be called.
|
Item Size |
It is the size of the item. |
Item Count |
Number of items. |
Content
MassivePickerLayoutGroup is assigned.
Items are generated automatically, so adding items to children is unnecessary.
How to set items
In MassivePicker, items are generated by the following flow.
1. Instantiate( massivePickerScrollRect.itemSource ) duplicates the item, and places it in Content’s children.
2. item.GetComponent<MassivePickerItem>().SetItemContents(scrollRect, itemIndex ) is called for the duplicated item and the content is set.
If the item is placed off screen and is no longer needed, SetActive(false) is called and the item becomes invisible.
When placed out of the screen again, SetActive(true) and SetItemContents() are called, and the item becomes visible.
An ExampleStringItem is attached to the item in MassiveVerticalPicker.
This script sets the text of the item to “Item” + itemIndex.
ItemSource
Object from which items are copied.
In MassiveVerticalPicker, it is placed inside Picker, but there is no restriction on the placement location.
Other objects
Same as Picker.