Logo
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.

Preview

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

NameTypeDescription
CurrentIndexintRead-only active item index.
IsTransitioningboolWhether a content transition is running.

Fields

NameTypeDescription
itemsList<Item>Carousel.Item definitions.
autoSlideboolEnables timed navigation.
autoSlideTimerfloatDelay between automatic slides.
showNeighborsboolDisplays adjacent items.
neighborOpacityfloatOpacity of adjacent items.
maxVisibleNeighborsintMaximum visible neighbors on either side.

Methods

NameParametersDescription
Refresh()NoneRefreshes generated items and indicators.
NextItem()NoneNavigates forward.
PreviousItem()NoneNavigates backward.
GoToItem()int indexNavigates to an index.

Example

CarouselExample.cs
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);
    }
}

On this page