Logo
UI Elements

Interactive

Shared input, visual states, scale, sounds, and cursor feedback

Overview

Interactive is the base for Evo UI controls such as Button and Switch. It extends Unity’s Selectable with click events, state notifications, graphic effects, state scaling, audio, and custom cursors. Add it on its own when a custom control needs the same feedback.


Usage

Add Interactive to a UI object with a raycast target. Resolve Raycast can supply a Raycast Area when needed.

Configure navigation and interaction events.

Enable the effects you want and assign their target Graphic.

Connect a Styler Object, or use Procedural Shape’s state color mappings, to respond to interaction states.


Customization

Scale

Scale resizes the control for each interaction state and animates the change with Evo Tween. Each state value multiplies the control's resting scale, so 1 keeps it unchanged and 1.05 makes it 5% larger. A control saved at 0.8 or flipped on an axis keeps those proportions.

Duration and Ease set the animation; see Easing. Custom uses the Curve below it. The animation ignores Time.timeScale, and a state change mid-animation continues from the current size. Target scales another Transform, such as a child visual; leave it empty to scale the control itself.

Scale runs only in Play Mode, so scenes and prefabs keep their saved scale. It changes X and Y and leaves Z as it is. The control returns to its resting scale when it's disabled or when Scale is turned off.
If another component also changes the control's scale, such as Dock Magnifier or Animated Container, assign a child as Target. A child target also keeps the clickable area fixed when a state value is below 1.

Graphic Effects

Ripple, Spotlight, and Border Glow each have their own settings object and target Graphic. Start with one effect, then adjust its color, timing, and coverage on the control itself. Turn on Ignore Graphic Alpha to keep an effect visible on a translucent or transparent background.

Audio and Cursors

Style Provider selects custom sound clips or Styler mappings. With Styler, Use Default Preset follows the project's default preset; turn it off to assign another one. Cursor States chooses which states override the system cursor; each state has its own texture and hotspot. Call RefreshCursor() after changing cursor settings while a state is active.


Interaction States

Styler maps Disabled, Normal, Highlighted, Pressed, and Selected to visual feedback. A visual state alone does not disable input; turn off Interactable when the control should stop responding.


Public API

Use Interactive in the Evo.UI namespace.

Properties

NameTypeDescription
InteractionStateInteractionStateCurrent visual state.
TransitionDurationfloatDuration used by interaction color transitions.

Fields

NameTypeDescription
rippleRipple.SettingsRipple configuration, including enabled and targetGraphic.
spotlightSpotlight.SettingsSpotlight configuration.
borderGlowBorderGlow.SettingsBorder glow configuration.
scaleEffectInteractive.ScaleEffectScale configuration, including enabled, target, and the state values.
styleProviderStyleProviderResolves custom or Styler audio mappings.
useDefaultStylerPresetboolLocks the preset to the current default Styler Preset when using Styler.
soundEffectsboolEnables interaction sounds.
cursorStatesCursorStatesStates allowed to override the cursor.

Methods

NameParametersDescription
SetState()InteractionState state, bool instant = falseChanges the visual state; instant skips its transition.
SetInteractable()bool valueChanges input availability and refreshes the state.
RefreshCursor()NoneReapplies the cursor for the current state.

Events

NameTypeDescription
onClickUnityEventInvoked by a valid click or submit.
onDoubleClickUnityEventUsed by Button’s double-click handling.
onPointerDownUnityEventPointer pressed.
onPointerUpUnityEventPointer released.
onPointerEnterUnityEventPointer entered.
onPointerExitUnityEventPointer exited.
onSelectUnityEventSelected by the EventSystem.
onDeselectUnityEventDeselected by the EventSystem.
onSubmitUnityEventSubmit input received.
OnStateChangedAction<InteractionState>C# event carrying the new interaction state.

Scale Effect

Interactive.ScaleEffect exposes enabled, target, duration, ease, curve, and the disabled, normal, highlighted, pressed, and selected values. ease uses Ease from Evo.Tween. GetMultiplier() returns the value for a state, and Clear() stops the animation and restores the resting scale. Changes made from code apply on the next state change.

Example

InteractiveExample.cs
using UnityEngine;
using Evo.UI;

public class InteractiveExample : MonoBehaviour
{
    [SerializeField] private Interactive target;

    private void Start()
    {
        target.ripple.enabled = true;
        target.spotlight.enabled = true;
        target.scaleEffect.enabled = true;
        target.scaleEffect.pressed = 0.9f;
        target.SetInteractable(true);
        target.onClick.AddListener(() => Debug.Log("Activated"));
    }
}

On this page