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:

C#
// 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:

URL
https://github.com/nimritagames/Unity-FlowUI.git
  1. In Unity, go to Window → Package Manager
  2. Click the + button in the top-left
  3. Select Add package from git URL
  4. Paste the URL above and click Add

Method 2: Local Clone

bash
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

  1. Add UIManager to your scene: Create an empty GameObject and add the UIManager component, or use the Quick Start Window (Tools → FlowUI → Quick Start).
  2. Scan your UI elements: In the UIManager inspector, go to the UI Hierarchy tab and click Scan Scene for UI Elements.
  3. Generate your library: Go to the Library Generation tab, set your output path and namespace, then click Generate.
  4. Use in code: Access your UI elements with type-safe dot-notation:
C#
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

DependencyMinimum Version
Unity2022.3 LTS or later
TextMeshPro3.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 UIReference entries — one per registered UI element
  • A list of UICategory entries for organizational grouping
  • An internal dictionary for fast path-based lookups at runtime
Tip You only need one UIManager per scene. If you have multiple canvases, they can all be managed by the same UIManager.

UIReference & UICategory

UIReference

Each registered UI element is stored as a UIReference with:

  • referenceName — A unique name derived from the GameObject name
  • path — The full hierarchy path (e.g., "Canvas/MainMenu/PlayButton")
  • elementType — The UIElementType enum value
  • gameObjectRef — A direct reference to the GameObject
  • category — The category this element belongs to

UICategory

Categories group related UI elements together:

  • categoryName — Display name for the category
  • color — 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:

TypeComponentDescription
ButtonButtonStandard Unity button
TextTMP_TextTextMeshPro text element
ImageImageUnity UI Image
RawImageRawImageRaw texture display
ToggleToggleCheckbox / toggle switch
SliderSliderSlider control
ScrollbarScrollbarScrollbar component
DropdownTMP_DropdownDropdown selector
InputFieldTMP_InputFieldText input field
ScrollRectScrollRectScrollable area
CanvasCanvasCanvas root
CanvasGroupCanvasGroupGroup alpha/interaction
LayoutGroupLayoutGroupVertical/Horizontal/Grid layout
PanelRectTransformGeneric panel container
MaskMask / RectMask2DMasking component
ContentSizeFitterContentSizeFitterAuto-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.

paths
// 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.

Note Scanning does not remove existing registrations. It only adds newly discovered elements. Use the bulk operations or manual removal to clean up.

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

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:

C# — Generated
// 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.

Warning The generated library file is overwritten on every generation. Any manual edits will be lost. Use event handlers (partial classes) for custom logic.

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.

C# — Generated Handler
// 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:

C# — Your Implementation
// Your custom implementation — never overwritten
public partial class MainMenuHandlers
{
    void OnPlayButtonClicked()
    {
        SceneManager.LoadScene("GameScene");
    }

    void OnSettingsButtonClicked()
    {
        UI.Panels.ToggleSettings();
    }
}

Handler Generation — Supported Events

ComponentEventHandler Signature
ButtononClickvoid OnXClicked()
ToggleonValueChangedvoid OnXChanged(bool value)
SlideronValueChangedvoid OnXChanged(float value)
DropdownonValueChangedvoid OnXChanged(int index)
InputFieldonValueChangedvoid OnXChanged(string text)
InputFieldonEndEditvoid OnXEndEdit(string text)
ScrollRectonValueChangedvoid OnXScrolled(Vector2 pos)

Panel Handlers — Show / Hide / Toggle

For every registered Panel element, FlowUI generates convenience methods:

C#
// 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:

C#
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
Tip Run a missing reference scan after reorganizing your UI hierarchy or deleting GameObjects.

Smart Naming Tab

The Smart Naming Assistant enforces consistent naming across your UI hierarchy. It supports 6 naming conventions:

  • PascalCasePlayButton, HealthBar
  • camelCaseplayButton, healthBar
  • snake_caseplay_button, health_bar
  • kebab-caseplay-button, health-bar
  • UPPER_SNAKE_CASEPLAY_BUTTON, HEALTH_BAR
  • Hungarian NotationbtnPlay, 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

public void AddUIReference(GameObject go, UIElementType type, string category = "")

Registers a UI element with the UIManager. If the element is already registered, this is a no-op.

  • go — The GameObject to register
  • type — The UI element type
  • category — Optional category name (auto-detected if empty)

RemoveUIReference

public void RemoveUIReference(string referenceName)

Unregisters a UI element by its reference name. The GameObject is not destroyed.

UIManager — Query Methods

IsRegistered

public bool IsRegistered(string referenceName)

Returns true if an element with the given name is registered.

GetUIComponent<T>

public T GetUIComponent<T>(string referenceName) where T : Component

Returns the specified component from a registered UI element. Returns null if not found.

GetPanel

public GameObject GetPanel(string panelName)

Returns the GameObject for a registered panel by name.

UIManager — Panel Methods

SetPanelActive

public void SetPanelActive(string panelName, bool active)

Activates or deactivates a panel's GameObject.

TogglePanel

public void TogglePanel(string panelName)

Toggles a panel's active state.

IsPanelVisible

public bool IsPanelVisible(string panelName)

Returns whether the panel's GameObject is currently active.

UIManager — Maintenance

InitializeDictionaries

public void 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

public ValidationResult ValidateState()

Checks all registrations for missing references, duplicate names, and other integrity issues.

RefreshStalePaths

public void RefreshStalePaths()

Updates stored hierarchy paths for all references to match current scene state. Use after reparenting UI elements.

UIReference Properties

PropertyTypeDescription
referenceNamestringUnique identifier for this element
pathstringFull hierarchy path
elementTypeUIElementTypeType of UI component
gameObjectRefGameObjectReference to the scene object
categorystringCategory assignment

UIElementType Enum

C#
public enum UIElementType
{
    Button, Text, Image, RawImage,
    Toggle, Slider, Scrollbar, Dropdown,
    InputField, ScrollRect, Canvas, CanvasGroup,
    LayoutGroup, Panel, Mask, ContentSizeFitter
}

UICategory

PropertyTypeDescription
categoryNamestringDisplay name
colorColorColor for editor visualization

Library Structure

Generated code follows this structure:

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.

C#
// 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:

MethodReturn TypeDescription
Show{Name}()voidActivates the panel GameObject
Hide{Name}()voidDeactivates the panel GameObject
Toggle{Name}()voidToggles active state
Is{Name}Visible()boolReturns current active state

Type Mapping Table

FlowUI maps each UIElementType to the corresponding Unity component type in generated code:

UIElementTypeGenerated Return TypeNamespace
ButtonButtonUnityEngine.UI
TextTMP_TextTMPro
ImageImageUnityEngine.UI
RawImageRawImageUnityEngine.UI
ToggleToggleUnityEngine.UI
SliderSliderUnityEngine.UI
ScrollbarScrollbarUnityEngine.UI
DropdownTMP_DropdownTMPro
InputFieldTMP_InputFieldTMPro
ScrollRectScrollRectUnityEngine.UI
CanvasCanvasUnityEngine
CanvasGroupCanvasGroupUnityEngine
LayoutGroupLayoutGroupUnityEngine.UI
PanelRectTransformUnityEngine
MaskMaskUnityEngine.UI
ContentSizeFitterContentSizeFitterUnityEngine.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.