Accordion
Options
Interactable
bool
Allow users interact with the Accordion.
Items (DataSource)
ObservableList<AccordionItem>
Items.
AccordionItem
fields:ToggleObject
GameObject
Click on this object open or close ContentObject.ContentObject
GameObject
Open
bool
Default state of the ContentObject.
Only One Open
bool
Only one item can be open at the same time.
All Items Can Be Closed
bool
Allow to close all items; otherwise at least one item always will be opened.
Animate
bool
Animate open and close.
Animation Duration
float
Animation Duration.
Unscaled Time
bool
Run animation with unscaled time.
Direction
AccordionDirection
Horizontal
Vertical
Resize Method
ResizeMethods
Size
- change width or height of the ContentObject.Flexible
- change LayoutElement flexibleWidth or flexibleHeight of the ContentObject.
Disable Closed
bool
Disable closed ContentObjects.
Events
OnToggleItem
UnityEvent<AccordionItem>
OnStartToggleAnimation
UnityEvent<AccordionItem>
OnDataSourceChanged
UnityEvent
AccordionHighlight
AccordionHighlightThemes
is a separate component to highlight ToggleObjects of the opened item.
Open item
Accordion.Open(Accordion.DataSource[0]);
Close item
Accordion.Close(Accordion.DataSource[0]);
Toggle item
Accordion.ToggleItem(Accordion.DataSource[0]);
Set items
Accordion.DataSource = new ObservableList<AccordionItem>()
{
new AccordionItem()
{
ToggleObject = Header1,
ContentObject = Content1,
Open = true,
},
new AccordionItem()
{
ToggleObject = Header2,
ContentObject = Content2,
Open = false,
},
new AccordionItem()
{
ToggleObject = Header3,
ContentObject = Content3,
Open = false,
},
};