Overview
FlowUI is a Unity editor tool that provides type-safe UI management for your projects. It scans your scene hierarchy, registers UI elements into a central registry, auto-categorizes them, and generates static C# classes for compile-time safe access.
Instead of using fragile GameObject.Find() calls or manually dragging references in the inspector, FlowUI gives you a clean, discoverable API:
// Access any UI element with IntelliSense and compile-time safety Button play = UI.MainMenu.PlayButton(); Slider health = UI.HUD.HealthBar(); UI.Panels.ShowMainMenu();
Key Capabilities
- Scene Scanning — Discovers 16 UI component types automatically
- Central Registry — All UI elements in one place with path-based identification
- Code Generation — Static classes with dot-notation access
- Event Handlers — Scaffolded handler methods using partial classes
- Panel Management — Generated Show/Hide/Toggle/IsVisible methods
- Missing Reference Detection — Scan, fix, and clean broken references
- Smart Naming — 6 naming conventions with conflict resolution
- Editor Integration — Full custom inspector with tabbed interface
Installation
Method 1: Git URL (Recommended)
Open the Unity Package Manager and add a package from Git URL:
https://github.com/nimritagames/Unity-FlowUI.git
- In Unity, go to Window → Package Manager
- Click the + button in the top-left
- Select Add package from git URL
- Paste the URL above and click Add
Method 2: Local Clone
git clone https://github.com/nimritagames/Unity-FlowUI.git
Then use Add package from disk in the Package Manager and select the package.json file.
Quick Start
- Add UIManager to your scene: Create an empty GameObject and add the
UIManagercomponent, or use the Quick Start Window (Tools → FlowUI → Quick Start). - Scan your UI elements: In the UIManager inspector, go to the UI Hierarchy tab and click Scan Scene for UI Elements.
- Generate your library: Go to the Library Generation tab, set your output path and namespace, then click Generate.
- Use in code: Access your UI elements with type-safe dot-notation:
using UnityEngine; public class GameUI : MonoBehaviour { void Start() { UI.MainMenu.PlayButton().onClick.AddListener(OnPlay); UI.MainMenu.SettingsButton().onClick.AddListener(OnSettings); } void OnPlay() { UI.Panels.HideMainMenu(); UI.Panels.ShowHUD(); } void OnSettings() { UI.Panels.ToggleSettings(); } }
Requirements
| Dependency | Minimum Version |
|---|---|
| Unity | 2022.3 LTS or later |
| TextMeshPro | 3.0.7+ |
| Unity UI (UGUI) | 1.0.0+ (com.unity.ugui) |
FlowUI is an editor tool with runtime components. It works on all build targets supported by Unity.
UIManager Component
The UIManager is the central MonoBehaviour that manages all registered UI elements. Add it to a single GameObject in your scene (typically on the Canvas root or a dedicated manager object).
It maintains:
- A list of
UIReferenceentries — one per registered UI element - A list of
UICategoryentries for organizational grouping - An internal dictionary for fast path-based lookups at runtime
UIReference & UICategory
UIReference
Each registered UI element is stored as a UIReference with:
referenceName— A unique name derived from the GameObject namepath— The full hierarchy path (e.g.,"Canvas/MainMenu/PlayButton")elementType— TheUIElementTypeenum valuegameObjectRef— A direct reference to the GameObjectcategory— The category this element belongs to
UICategory
Categories group related UI elements together:
categoryName— Display name for the categorycolor— Color-coding for the editor hierarchy view
Categories are auto-created based on top-level panels when scanning, but you can create custom ones.
UI Element Types
FlowUI supports the following 16 UI component types:
| Type | Component | Description |
|---|---|---|
| Button | Button | Standard Unity button |
| Text | TMP_Text | TextMeshPro text element |
| Image | Image | Unity UI Image |
| RawImage | RawImage | Raw texture display |
| Toggle | Toggle | Checkbox / toggle switch |
| Slider | Slider | Slider control |
| Scrollbar | Scrollbar | Scrollbar component |
| Dropdown | TMP_Dropdown | Dropdown selector |
| InputField | TMP_InputField | Text input field |
| ScrollRect | ScrollRect | Scrollable area |
| Canvas | Canvas | Canvas root |
| CanvasGroup | CanvasGroup | Group alpha/interaction |
| LayoutGroup | LayoutGroup | Vertical/Horizontal/Grid layout |
| Panel | RectTransform | Generic panel container |
| Mask | Mask / RectMask2D | Masking component |
| ContentSizeFitter | ContentSizeFitter | Auto-size container |
Path-Based Referencing
Every UI element is identified by its hierarchy path — the full path from the scene root to the element. This ensures unique identification even when multiple elements share the same name.
// Examples of hierarchy paths
Canvas/MainMenu/PlayButton
Canvas/MainMenu/SettingsButton
Canvas/HUD/HealthBar
Canvas/HUD/ScoreText
Canvas/Settings/VolumeSlider
Canvas/Settings/DifficultyDropdown
When code is generated, these paths are used internally for lookups, while the generated API gives you clean dot-notation access.
UI Hierarchy — Scanning
The UI Hierarchy tab is the primary interface for managing your registered UI elements.
Scanning Your Scene
Click "Scan Scene for UI Elements" to automatically discover all UI components in your scene hierarchy. FlowUI checks every GameObject for supported component types and offers to register them.
UI Hierarchy — Adding & Removing
Adding Elements
You can add elements in three ways:
- Scene scan — Automatic discovery of all UI elements
- Manual add — Drag a GameObject into the add slot in the inspector
- Context menu — Right-click a UI element in the hierarchy and select "Register with FlowUI"
Removing Elements
Click the X button next to any element in the list to unregister it. The element remains in your scene — only the FlowUI registration is removed.
UI Hierarchy — Bulk Operations
For managing large UI hierarchies efficiently:
- Select All / Deselect All — Toggle selection for batch operations
- Remove Selected — Unregister multiple elements at once
- Remove Missing — Clean up references to deleted GameObjects
UI Hierarchy — Search
The search bar at the top of the hierarchy tab filters elements by name, path, or type. Search is case-insensitive and matches partial strings.
Library Generation — Output Settings
Configure how your UI library code is generated:
- Output Path — Where the generated C# file is saved (default:
Assets/Scripts/Generated/) - Namespace — The C# namespace for generated classes (default: none / global)
- Class Name — The root static class name (default:
UI)
Library Generation — Generated Code Structure
FlowUI generates a static class hierarchy that mirrors your UI organization:
// Auto-generated by FlowUI — do not edit manually using UnityEngine; using UnityEngine.UI; using TMPro; public static class UI { private static UIManager _mgr; private static UIManager Mgr => _mgr != null ? _mgr : _mgr = Object.FindObjectOfType<UIManager>(); public static class MainMenu { public static Button PlayButton() => Mgr.GetUIComponent<Button>("PlayButton"); public static Button SettingsButton() => Mgr.GetUIComponent<Button>("SettingsButton"); } public static class HUD { public static Slider HealthBar() => Mgr.GetUIComponent<Slider>("HealthBar"); public static TMP_Text ScoreText() => Mgr.GetUIComponent<TMP_Text>("ScoreText"); } public static class Panels { public static void ShowMainMenu() => Mgr.SetPanelActive("MainMenu", true); public static void HideMainMenu() => Mgr.SetPanelActive("MainMenu", false); public static void ToggleMainMenu() => Mgr.TogglePanel("MainMenu"); public static bool IsMainMenuVisible() => Mgr.IsPanelVisible("MainMenu"); } }
Library Generation — Regeneration
Regenerate your library any time you add, remove, or rename UI elements. The generated file is completely overwritten — do not manually edit it.
Handler Generation — Event Handlers
FlowUI can generate event handler scaffolding for your UI elements. This creates method stubs for button clicks, toggle changes, slider values, and more.
// Generated handler base class public partial class MainMenuHandlers : MonoBehaviour { void Start() { UI.MainMenu.PlayButton().onClick.AddListener(OnPlayButtonClicked); UI.MainMenu.SettingsButton().onClick.AddListener(OnSettingsButtonClicked); } }
Handler Generation — Partial Classes
Handlers use the partial keyword so you can implement your logic in a separate file that won't be overwritten:
// Your custom implementation — never overwritten public partial class MainMenuHandlers { void OnPlayButtonClicked() { SceneManager.LoadScene("GameScene"); } void OnSettingsButtonClicked() { UI.Panels.ToggleSettings(); } }
Handler Generation — Supported Events
| Component | Event | Handler Signature |
|---|---|---|
| Button | onClick | void OnXClicked() |
| Toggle | onValueChanged | void OnXChanged(bool value) |
| Slider | onValueChanged | void OnXChanged(float value) |
| Dropdown | onValueChanged | void OnXChanged(int index) |
| InputField | onValueChanged | void OnXChanged(string text) |
| InputField | onEndEdit | void OnXEndEdit(string text) |
| ScrollRect | onValueChanged | void OnXScrolled(Vector2 pos) |
Panel Handlers — Show / Hide / Toggle
For every registered Panel element, FlowUI generates convenience methods:
// Show a panel (activates the GameObject) UI.Panels.ShowMainMenu(); // Hide a panel (deactivates the GameObject) UI.Panels.HideMainMenu(); // Toggle visibility UI.Panels.ToggleMainMenu();
Panel Handlers — IsVisible
Check if a panel is currently active:
if (UI.Panels.IsMainMenuVisible()) { Debug.Log("Main menu is open"); }
Categories Tab
The Categories tab lets you manage organizational groups for your UI elements:
- Color Coding — Assign colors to categories for visual distinction in the hierarchy view
- Filtering — Filter the hierarchy view by category to focus on specific UI groups
- Multi-Select — Select multiple elements and reassign them to a different category
Categories are auto-created during scanning based on top-level parent panels, but you can rename, recolor, merge, or create custom categories at any time.
Missing References Tab
Over time, UI elements may be deleted from the scene while their registrations remain. The Missing References tab helps you find and fix these:
- Scan — Check all registrations for broken references
- Auto-Fix — Attempt to re-link references by matching names in the hierarchy
- Manual Fix — Drag the correct GameObject to re-link
- Bulk Remove — Remove all missing references at once
Smart Naming Tab
The Smart Naming Assistant enforces consistent naming across your UI hierarchy. It supports 6 naming conventions:
- PascalCase —
PlayButton,HealthBar - camelCase —
playButton,healthBar - snake_case —
play_button,health_bar - kebab-case —
play-button,health-bar - UPPER_SNAKE_CASE —
PLAY_BUTTON,HEALTH_BAR - Hungarian Notation —
btnPlay,sldHealth
Features include conflict detection, batch rename preview, and undo support. Preview all changes before applying them.
Tools Tab
- Refresh — Re-scan the scene and update all references
- Reset — Clear all registrations and start fresh
- Debug Mode — View raw serialized data for all registered elements
UIManager — Add / Remove Reference
AddUIReference
Registers a UI element with the UIManager. If the element is already registered, this is a no-op.
go— The GameObject to registertype— The UI element typecategory— Optional category name (auto-detected if empty)
RemoveUIReference
Unregisters a UI element by its reference name. The GameObject is not destroyed.
UIManager — Query Methods
IsRegistered
Returns true if an element with the given name is registered.
GetUIComponent<T>
Returns the specified component from a registered UI element. Returns null if not found.
GetPanel
Returns the GameObject for a registered panel by name.
UIManager — Panel Methods
SetPanelActive
Activates or deactivates a panel's GameObject.
TogglePanel
Toggles a panel's active state.
IsPanelVisible
Returns whether the panel's GameObject is currently active.
UIManager — Maintenance
InitializeDictionaries
Rebuilds the internal lookup dictionaries from the serialized reference list. Called automatically on Awake, but can be called manually if references change at runtime.
ValidateState
Checks all registrations for missing references, duplicate names, and other integrity issues.
RefreshStalePaths
Updates stored hierarchy paths for all references to match current scene state. Use after reparenting UI elements.
UIReference Properties
| Property | Type | Description |
|---|---|---|
referenceName | string | Unique identifier for this element |
path | string | Full hierarchy path |
elementType | UIElementType | Type of UI component |
gameObjectRef | GameObject | Reference to the scene object |
category | string | Category assignment |
UIElementType Enum
public enum UIElementType { Button, Text, Image, RawImage, Toggle, Slider, Scrollbar, Dropdown, InputField, ScrollRect, Canvas, CanvasGroup, LayoutGroup, Panel, Mask, ContentSizeFitter }
UICategory
| Property | Type | Description |
|---|---|---|
categoryName | string | Display name |
color | Color | Color for editor visualization |
Library Structure
Generated code follows this structure:
UI (root static class)
├── MainMenu (nested static class per category)
│ ├── PlayButton() → Button
│ ├── SettingsButton() → Button
│ └── TitleText() → TMP_Text
├── HUD
│ ├── HealthBar() → Slider
│ ├── ScoreText() → TMP_Text
│ └── MiniMap() → RawImage
└── Panels
├── ShowMainMenu() → void
├── HideMainMenu() → void
├── ToggleMainMenu() → void
└── IsMainMenuVisible() → bool
Dot-Notation Access
Every element is accessible via UI.Category.ElementName(). The parentheses are required because the accessor is a method that performs a lookup — this ensures you always get the current reference, even if the scene reloads.
// Button access UI.MainMenu.PlayButton().onClick.AddListener(() => { }); // Text access UI.HUD.ScoreText().SetText($"Score: {score}"); // Slider access float hp = UI.HUD.HealthBar().value;
Panel Methods
For every registered Panel, four methods are generated in UI.Panels:
| Method | Return Type | Description |
|---|---|---|
Show{Name}() | void | Activates the panel GameObject |
Hide{Name}() | void | Deactivates the panel GameObject |
Toggle{Name}() | void | Toggles active state |
Is{Name}Visible() | bool | Returns current active state |
Type Mapping Table
FlowUI maps each UIElementType to the corresponding Unity component type in generated code:
| UIElementType | Generated Return Type | Namespace |
|---|---|---|
| Button | Button | UnityEngine.UI |
| Text | TMP_Text | TMPro |
| Image | Image | UnityEngine.UI |
| RawImage | RawImage | UnityEngine.UI |
| Toggle | Toggle | UnityEngine.UI |
| Slider | Slider | UnityEngine.UI |
| Scrollbar | Scrollbar | UnityEngine.UI |
| Dropdown | TMP_Dropdown | TMPro |
| InputField | TMP_InputField | TMPro |
| ScrollRect | ScrollRect | UnityEngine.UI |
| Canvas | Canvas | UnityEngine |
| CanvasGroup | CanvasGroup | UnityEngine |
| LayoutGroup | LayoutGroup | UnityEngine.UI |
| Panel | RectTransform | UnityEngine |
| Mask | Mask | UnityEngine.UI |
| ContentSizeFitter | ContentSizeFitter | UnityEngine.UI |
Common Issues
Generated code has compile errors
Cause: Usually happens when UI elements are renamed or removed after generation.
Fix: Re-run Library Generation to regenerate the code.
UI element returns null at runtime
Cause: The UIManager hasn't initialized yet, or the referenced element was destroyed.
Fix: Ensure your code runs after Awake() (use Start() or later). Check the Missing References tab for broken references.
Elements not found during scan
Cause: GameObjects may be inactive, or components may be on child objects not in the scan scope.
Fix: Make sure the GameObjects are active, or use manual registration for specific elements.
Duplicate reference names
Cause: Two UI elements in different parts of the hierarchy share the same name.
Fix: Rename one of the GameObjects, or use the Smart Naming Assistant to resolve conflicts.
FAQ
Can I use FlowUI with multiple scenes?
Yes. Each scene should have its own UIManager instance. The generated code references the UIManager in the active scene.
Does FlowUI work with additive scene loading?
Yes, but you may need to call InitializeDictionaries() after loading a new scene if UI elements are added dynamically.
Can I register elements at runtime?
Yes. Call AddUIReference() to register new elements. Note that the generated static classes won't include runtime additions — use the UIManager API directly for dynamic elements.
What happens if I delete a registered GameObject?
The registration becomes a missing reference. Use the Missing References tab to detect and clean these up, then regenerate your library.
Is there a performance cost at runtime?
Minimal. UIManager uses dictionary lookups (O(1)) for element access. The initial dictionary build happens once in Awake(). There is no per-frame overhead.
Can I customize the generated code template?
Not currently. The code generation follows a fixed template optimized for type-safety and performance. This may be configurable in a future version.