Skip to content

Repository files navigation

NowUI — immediate-mode UI for Unity. Logo banner rendered by NowUI itself.

Now-UI

Now-UI is an immediate-mode UI renderer for Unity. You call the drawing API each frame and flush — no GameObject hierarchy, no retained UI tree — but the toolbox is complete: batched rectangles, MSDF text with runtime font compilation, CSS-inspired gradients, a flexbox-style layout system, pointer/touch/gamepad interaction, themes, and Lottie vector animation.

It renders through the built-in pipeline (GL/Graphics.DrawMeshNow), URP, HDRP, a UGUI CanvasRenderer, UI Toolkit/UXML, a world-space MeshRenderer, a RenderTexture, or IMGUI — same drawing code everywhere.

Showcase

Every image in this README — the logo above included — was drawn by NowUI itself: the repository's deterministic visual harness renders each scene into an offscreen RenderTexture and writes the PNG to disk (Tools/NowUI-Harness.ps1 -Mode Visual). No editor screenshots, no compositing.

In-app documentation browser rendered with NowUI, including live 3D model previews and syntax-highlighted code

The in-app docs browser from NowDocsExample: sidebar navigation, scroll views, controls, syntax-shaped code blocks, and three live camera-backed 3D model previews sharing one immediate-mode frame.

Custom SDF shader gallery: animated aurora, topographic contours, relit paper cutout Composable SDF scenes with custom final-shading — animation, distance fields, relighting. SDF Shapes SDF mask gallery: boolean cutouts, text-shaped masks, feathered edge coverage Boolean cutouts, text-shaped masks, and feathered coverage. Masks
Two 3D model previews, one drawn directly and one captured then wave-deformed 3D models rendered to transparent textures and composed like any other draw — here with a texture-backed wave deformer. Model Previews, Effects Controls gallery in the dark theme: buttons, toggles, sliders, fields, dropdowns The stock control set under the dark theme preset. Controls, Styles & Themes
Dockable tabbed windows with a scene view, hierarchy, and inspector panes Dockable tabbed windows with side splits, splitter resizing, and drag-to-dock guides. Docking Node graph with typed ports and bezier links Schema-driven node graph with typed ports, bezier links, and undo history. Node Graph

Google-style landing page mockup built from NowUI primitives

A pixel-faithful landing page from NowLandingPageExample — nothing but text, colors, controls, and rectangles.

Installation

Install as a UPM package via git URL (Window > Package Manager > + > Install package from git URL):

https://github.com/BlenMiner/NowUI.git?path=Assets/NowUI

Or clone the repository and open it as a Unity project to work on Now-UI itself.

Requirements:

  • Unity 6000.4 or newer
  • Dependencies (installed automatically): Burst, Collections, and Mathematics
  • Optional input backend: add com.unity.inputsystem for the Input System
  • Optional host integrations: add com.unity.ugui for NowGraphic, NowLayoutGraphic, NowLottieGraphic, and NowUGUINavigationProxy; add com.unity.modules.uielements for NowVisualElement and NowLayoutVisualElement

NowUI detects those optional packages anywhere in Unity's resolved dependency graph, including transitive dependencies. No manual scripting define is required. Projects using an optional integration only need to ensure its package is present; add it to the project manifest if no other dependency supplies it.

When the Input System is installed and enabled, NowUI's default provider prefers it. Otherwise it falls back to the legacy Input Manager when that backend is enabled, including mouse, touch, keyboard navigation, text, and IME input. Reliable default gamepad navigation remains Input-System-only because legacy axes and buttons are project-defined. KeyBindingField, NowKeyInput, and NowKeyNames are also available only when com.unity.inputsystem resolves; their public API uses UnityEngine.InputSystem.Key.

AI coding agents

The UPM package ships version-matched documentation, a scoped AGENTS.md, and an installable nowui skill. After installation, use Tools > NowUI > AI > Install Agent Skill in Unity, or have the agent begin with Assets/NowUI/Documentation~/AI_GUIDE.md. The package also provides Tools > NowUI > AI > Copy Project AGENTS.md Snippet for projects or agents that use repository instructions without skills.

Quick Start

The examples below use the optional UGUI hosts, so com.unity.ugui must be present in the project's resolved dependency graph.

Choose the placement API by one simple rule: use Now when you already have rects, and use NowLayout when you want the library to arrange rows and columns. Its fluent containers provide identical Row/Horizontal and Column/Vertical naming pairs.

For explicit placement, derive from the one-pass NowGraphic host and draw directly into known bounds:

using UnityEngine;
using NowUI;

public sealed class ScoreOverlay : NowGraphic
{
    protected override void DrawNowUI(NowRect view)
    {
        var panel = new NowRect(view.x + 20, view.y + 20, 260, 80);
        Now.Rectangle(panel)
            .SetColor(new Color(0, 0, 0, 0.8f))
            .SetRadius(10)
            .Draw();

        Now.Text(panel.Inset(16))
            .SetFontSize(32)
            .SetColor(Color.white)
            .Draw("Score: 1200");
    }
}

The score overlay the snippet above renders: a rounded translucent panel with Score: 1200

For responsive placement, derive from NowLayoutGraphic. It owns the exact measure/draw cycle, so the layout code only describes intent:

public sealed class SettingsPanel : NowLayoutGraphic
{
    protected override void DrawNowUI(NowRect view)
    {
        using (NowLayout.Column(view).Padding(16).Gap(8).Begin())
        {
            NowLayout.Label("Hello Now-UI").SetFontSize(32).Draw();

            using (NowLayout.Row()
                .FillWidth()
                .AlignChildren(NowLayoutAlign.Center)
                .Begin())
            {
                NowLayout.Label("Status").Draw();
                NowLayout.Spacer();
                NowLayout.Label("Ready").Draw();
            }

            NowLayout.Button("Sample Button").Draw();
        }
    }
}

The settings panel the snippet above renders: a title, a status row, and a themed button

NowLayout.ReserveRect(...) bridges the two styles by reserving a layout slot and returning its resolved rect for a Now primitive. Manual hosts such as a camera callback use Now.StartUI(...) and NowLayout.RunMeasured(...); the layout-specific hosts do not need RunMeasured. For URP/HDRP, UGUI, UI Toolkit, world-space, and manual-host examples, see Documentation~/RenderPipelines.md and Documentation~/Layout.md.

Features

  • Rectangles — rounded corners (per-corner radii), outlines, blur, padding, masks, textures, sprites, and custom materials. Documentation~/Features.md, Documentation~/CustomMaterials.md
  • Masks — exact rectangular clips plus anti-aliased analytic rectangles, rounded rectangles, circles, ellipses, and capsules with soft screen-pixel feathers. Documentation~/Masks.md
  • Gradients — directional linear, circular/elliptical radial, and conic paints with repeating spread modes and Unity Gradient ramps. Documentation~/Gradients.md
  • Glass — rounded backdrop panes that blur previously rendered target content on command-buffer and RenderTexture-backed hosts, plus automatic UGUI replay blur for NowUI content, with tint, outline, and radius controls. Documentation~/Glass.md
  • Lines — anti-aliased straight lines, cubic Beziers, dashed strokes, rounded caps, masks, and arrow heads. Documentation~/Lines.md
  • Shapes — filled or outlined circles, ellipses, triangles, and reusable array/list-backed polygons. Documentation~/Shapes.md
  • Effects — scoped mesh and texture-backed visual modifiers with custom vertex deformers and explicit subdivision. Documentation~/Effects.md
  • Model Previews — reusable 3D models rendered into transparent textures, from isolated raw meshes or caller-owned scene objects, with automatic framing, dirty/continuous updates, masks, corners, materials, and effects. Documentation~/ModelPreviews.md
  • World Space — direct-mesh nameplates, hover tooltips and diegetic panels with ray-mapped input, configurable depth, and vertex deformation. Documentation~/WorldSpace.md
  • Text — SDF atlases baked on demand by a Burst-compiled managed compiler (native plugin covers CFF and color emoji fonts); HarfBuzz shaping for ligatures, kerning, and complex scripts where the plugin is present, falling back per codepoint elsewhere; contextual font stack via using (Now.Font(...)).
  • Text Preprocessor — one registered hook every UI string resolves through before measurement, so localization (and any other string transform: casing, terminology, pseudo-loc) gets correct layout for free; memoized per unique string, explicit invalidation on language switch, and SetRaw() opt-outs for verbatim text. Documentation~/TextPreprocessor.md
  • Layout — fluent Row/Horizontal and Column/Vertical container aliases with gaps, padding, growth, alignment, justification, and exact-measure layout hosts. Documentation~/Layout.md
  • Input — immediate-mode NowInput.Interact with hover, press, drag, and click across mouse, touch, and keyboard on either built-in backend, plus gamepad support through the optional Input System; pluggable providers for RenderTextures, tests, and remote input.
  • Controls — buttons, checkboxes, radios, sliders, text fields, dropdowns, and scroll views with focus navigation, theming, and a public toolkit for building custom controls. Documentation~/Controls.md
  • Typed identity — authored NowId keys, opaque host-owned NowResolvedId paths, reorder-safe keyed collection scopes, and composite hit-region exclusions. Documentation~/Identity.md
  • Lottie — vector animations tessellated live on the CPU, never rasterized to textures. Documentation~/Lottie.md
  • Themes — ScriptableObject color/spacing/radius tokens and presets. Documentation~/StylesAndThemes.md
  • Mobile — density-scaled units (Now.StartUI(uiScale)), safe-area helpers, touch input, Android/iOS native plugins. Documentation~/Mobile.md
  • Analyzer — a bundled Roslyn analyzer warns at compile time when a builder is missing its .Draw() or a using-only scope is discarded, in the Unity console and your IDE. No heuristics — it only flags provably dead code. Documentation~/Controls.md
  • Markdown — GitHub-flavored Markdown rendered through NowUI primitives (headings, emphasis, code, quotes, lists, tables, links) with theme colors and zero steady-state allocation. No HTML, no JavaScript. Documentation~/Markdown.md
  • Docking — dockable tabbed windows with side splits, splitter resizing, floating windows, tab-drag dock guides, and tab reordering via the NowDockSpace extension. Documentation~/Docking.md
  • SDF Shapes — composable SDF circles, boxes, rounded and chamfered boxes, triangles, ellipses, capsules, round-capped lines, arcs, and pies with explicit next-operand and scoped rotation for primitives and text, union/subtract/intersect operations, smooth blends, colors, and texture fills, plus scene-level outlines, shadows, glow, embossing, contours, and warp. Documentation~/SDF.md

API compatibility and allocation rules are tracked in Documentation~/API.md; release and Asset Store validation gates are in Docs/Production.md.

Platform support

Native plugins (the nowui-msdf font compiler and nowui-vg Lottie tessellator) are prebuilt and committed under Assets/NowUI/Plugins:

Platform Font compilation Lottie tessellation
Windows x64 native native
Linux x64 native native
macOS x64 / arm64 native native
Android arm64-v8a native native
iOS arm64 native (static) native (static)
WebGL native (static) native (static)
Everything else (consoles, tvOS, ...) managed fallback (Burst) managed fallback

Native plugins are a performance upgrade, never a requirement: on platforms without binaries, fonts bake through a Burst-compiled managed SDF compiler and Lottie falls back to a managed tessellator, so NowUI runs anywhere Unity does. The managed font fallback covers TrueType (glyf) outlines; CFF-flavored OpenType and color emoji fonts still need the native compiler. WebGL and iOS link the plugins statically, so those files must be present at build time.

CI installs URP and HDRP independently and requires each optional NowUI integration assembly to compile and load; URP additionally has focused pixel coverage. A scheduled player-build matrix covers Windows, Linux, macOS, Android arm64, iOS arm64 (including an unsigned Xcode device link), and WebGL. See Production Gates for the exact coverage and the remaining HDRP runtime-fixture gap.

Native plugin CI

A single workflow, .github/workflows/build-native-libraries.yml, builds both plugins for every platform and commits the artifacts back to the repository. It runs automatically when anything under Assets/NowUI/Plugins/Native/ changes and can also be dispatched manually with custom msdf-atlas-gen and Emscripten versions. The WebGL artifacts are pinned to Emscripten 3.1.38 to match Unity 6's WebGL toolchain; rebuild with a matching version if Unity changes its bundled toolchain.

Project Layout

  • Assets/NowUI — the UPM package (runtime, editor, examples, native plugin sources and binaries)
  • Assets/NowUITests — repository-only EditMode/PlayMode tests and visual golden baselines; excluded from package exports
  • Assets/NowUIHarness — repository-only visual and performance harness; excluded from package exports
  • Assets/NowUI/Runtime — drawing API, layout, input, text, Lottie, themes, and host integrations including UGUI, UI Toolkit, IMGUI, and world space
  • Assets/NowUI/Editor — font compiler menu, .lottie importer
  • Assets/NowUI/Plugins/Native — native wrapper sources built by CI
  • Assets/NowUI/Example — sample scripts, including MailClientMockup, a Gmail-like inbox drawn entirely with immediate NowUI calls; NowLandingPageExample and NowLayoutLandingPageExample, the same search page expressed with explicit rects and layout intent; and NowWorldGraphicExample, a direct-mesh world-space label
  • Assets/NowUI/Samples~ — customer-importable UPM samples
  • Assets/NowUI/Documentation~ — public, version-matched package guides
  • Docs — maintainer-only design, benchmark, and release notes

Notes

  • Wrap screen drawing in using (Now.StartUI(...)). Disposing that scope submits rendering and finalizes input for the frame, so early returns and exceptions do not leave the frame half-open. Draw order is preserved; switching materials flushes the active mesh.
  • Use id-less controls and interactions for one-off UI (NowLayout.Button("Save"), NowInput.Interact(rect)). Prefer stable data keys (SetId(item.id), KeyedItem(item.id)) for controls that can appear, disappear, or reorder. Authored strings/integers use NowId and stay local to the active host/id scope. Runtime paths use the opaque NowResolvedId; pass them directly and derive children with .Child(...).
  • The hot path is allocation-free once buffers, glyphs, effect textures, and world-space material batches are warm. First use, new ids, new material batches, and capacity growth may allocate.
  • For strict frame budgets, call NowDrawList.Warmup(...) or NowRenderer.Warmup(...) with a representative frame during initialization, use the input-aware overload when controls read pointer/focus state, prewarm known control-state ids with NowControlState.Warmup<T>(id), reserve opt-in diagnostic storage with NowGlassSettings.ReserveDiagnostics(...), then measure the real frame.
  • Emoji sequence shaping (ZWJ families, skin tones, flags) needs a future HarfBuzz shaping layer; single-glyph emoji render today.

License

NowUI is available under the MIT License. Bundled third-party components remain under their respective licenses; their notices are in Assets/NowUI/THIRD_PARTY_LICENSES.md.

About

No description, website, or topics provided.

Resources

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages