Unclaimed Package Is this your package? Claim it to unlock full analytics and manage your listing.
Claim This Package

Install via UPM

Add to Unity Package Manager using this URL

https://www.pkglnk.dev/ui-basics.git
AnkleBreaker Studio - Utils UI Basics

README Markdown

Copy this to your project's README.md

Style
Preview
pkglnk installs badge
## Installation

Add **AnkleBreaker Studio - Utils UI Basics** to your Unity project via Package Manager:

1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/ui-basics.git
```

[![pkglnk](https://www.pkglnk.dev/badge/ui-basics.svg?style=pkglnk)](https://www.pkglnk.dev/pkg/ui-basics)

Dependencies (1)

README

AnkleBreaker Studio - Utils UI Basics

Sponsor Asset Store

Reusable uGUI button components with state tracking, toggle behavior, and generic button-group management. Part of the AnkleBreaker Utils split.

Installation

Add via Unity Package Manager using the Git URL:

https://github.com/AnkleBreaker-Studio/AnkleBreaker-Utils-UI-Basics.git#Release

Dependencies

Package Install URL
Utils Inspector https://github.com/AnkleBreaker-Studio/AnkleBreaker-Utils-Inspector.git#Release

Runtime Components

ABButton

Enhanced UnityEngine.UI.Button that exposes selection-state transitions via C# events and per-state UnityEvents.

Feature Description
OnStateChanged(prev, new) C# event fired on every state transition
OnHoveredChanged(bool) C# event fired on pointer enter/exit
PrevState / CurrentState Read-only state tracking
IsHovered Independent hover tracking
_onNormal, _onHover, _onUnhover, _onSelected, _onDisabled Per-state UnityEvents wirable from inspector

On Reset, auto-configures a transparent Image for raycasting and disables navigation/transition.

IUISwitch

Interface for UI elements with an on/off toggle state.

public interface IUISwitch
{
    bool IsOn { get; }
    void SetIsOn(bool on);
}

UISwitchButton

Toggle-style button inheriting ABButton and implementing IUISwitch.

Feature Description
IsOn Current toggle state
SwitchOnClick Whether clicking toggles the state (default: true)
_objToToggleOnSwitch Optional GameObject activated/deactivated with state
OnSwitchValueChanged(bool) C# event fired on toggle change
_onSwitchedOn, _onSwitchedOff, _onSwitchChanged UnityEvents for inspector wiring

On Reset, auto-assigns a child named "Display" as the toggle object.

UISwitchButtonsDic<K, V>

Generic serialized dictionary (K : Enum, V : UISwitchButton) for managing mutually-exclusive button groups (tabs, option selectors, panel switches).

Feature Description
Init(K defaultKey, bool unselectOnClick) Initialize with default selection and optional unselect-on-click
Select(K key) Switch selection, turning off all others
ClearSelection() Turn off all buttons
Reset() Unsubscribe listeners and reset state
UnselectOnClick When true, clicking the selected button clears the selection
OnSelectionChanged Callback when selection changes
OnSwitchClick Callback on any button click

Handles click listener lifecycle automatically. Safe to call Init() multiple times (calls Reset() internally).

Editor

ABButtonEditor

Custom inspector for ABButton and subclasses. Preserves the standard Button inspector while adding support for [FoldoutGroup], [ShowInInspector], [Button], [SectionHeader], [ToggleButton], and other Utils Inspector attributes. Collapses helper components (Image, CanvasRenderer) for a cleaner view.

Requirements

License

See LICENSE.md

Comments

No comments yet. Be the first!