UI Elements
Carousel
Slide through content with optional visible neighbors
Overview
Carousel displays one active item and can keep neighboring items visible. It supports automatic sliding, indicators, and generated content in Edit Mode.
Usage
Create a Carousel prefab and populate Items.
Assign its item and indicator presets.
Choose automatic sliding or connect navigation buttons to NextItem() and PreviousItem().
Enable Show Neighbors if adjacent items should remain visible.
Tips
- Neighbor Opacity, Max Visible Neighbors, and Item Spacing control the surrounding items.
- Adjust the slide offset, curve, and duration for transitions.
Public API
Use Carousel in the Evo.UI namespace.
Properties
| Name | Type | Description |
|---|---|---|
CurrentIndex | int | Read-only active item index. |
IsTransitioning | bool | Whether a content transition is running. |
Fields
| Name | Type | Description |
|---|---|---|
items | List<Item> | Carousel.Item definitions. |
autoSlide | bool | Enables timed navigation. |
autoSlideTimer | float | Delay between automatic slides. |
showNeighbors | bool | Displays adjacent items. |
neighborOpacity | float | Opacity of adjacent items. |
maxVisibleNeighbors | int | Maximum visible neighbors on either side. |
Methods
| Name | Parameters | Description |
|---|---|---|
Refresh() | None | Refreshes generated items and indicators. |
NextItem() | None | Navigates forward. |
PreviousItem() | None | Navigates backward. |
GoToItem() | int index | Navigates to an index. |
Example
using UnityEngine;
using Evo.UI;
public class CarouselExample : MonoBehaviour
{
[SerializeField] private Carousel target;
private void Start()
{
target.autoSlide = false;
target.showNeighbors = true;
target.neighborOpacity = 0.4f;
target.maxVisibleNeighbors = 1;
target.Refresh();
target.GoToItem(0);
}
}