Evo uiUi elements
Scrollbar
An extended Scrollbar component
This page documents Evo UI v1. For the current version, see Evo UI v2. Upgrading? Read the migration guide.
Overview
Scrollbar extends the built in Unity Scrollbar and adds smooth scrolling, optional auto hide behavior, and arrow button support. It keeps full compatibility with Unity UI while offering modern quality of life improvements.
Properties
Animation
| Name | Type | Description |
|---|---|---|
smoothDuration | float | Duration for smooth scrolling animation |
smoothCurve | AnimationCurve | Easing curve for scroll animation |
Auto Hide
| Name | Type | Description |
|---|---|---|
autoHide | bool | Enables automatic fade in and fade out |
hideAlpha | float | Alpha to use when hidden |
hideDuration | float | Duration of fade animation |
hideTimer | float | Time to wait before starting fade out |
References
| Name | Type | Description |
|---|---|---|
minArrow | Button | Optional button to scroll toward min |
maxArrow | Button | Optional button to scroll toward max |
Public Methods
| Name | Parameters | Description |
|---|---|---|
ScrollToMin() | None | Smoothly scrolls to min edge |
ScrollToMax() | None | Smoothly scrolls to max edge |
ScrollTo(targetValue) | float | Smooth scroll to normalized position |
ScrollTo(target, clamp, duration) | float, bool, float | Full custom ScrollTo |
ScrollBy(amount) | float | Additive scroll |
ScrollBy(amount, clamp, duration) | float, bool, float | Additive scroll with settings |
Code Example
using UnityEngine;
using Evo.UI;
public class ScrollbarExample : MonoBehaviour
{
public Scrollbar scrollbar;
void Start()
{
// Smooth scroll to 50%
scrollbar.ScrollTo(0.5f);
// Scroll by +0.1
scrollbar.ScrollBy(0.1f);
// Scroll instantly using Unity directly
scrollbar.value = 1f;
// Scroll to min or max
scrollbar.ScrollToMin();
scrollbar.ScrollToMax();
}
void Update()
{
// Example: scroll wheel manually
if (Input.GetKeyDown(KeyCode.UpArrow))
scrollbar.ScrollBy(0.1f);
if (Input.GetKeyDown(KeyCode.DownArrow))
scrollbar.ScrollBy(-0.1f);
}
}