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 still scenes into an offscreen RenderTexture (Tools/NowUI-Harness.ps1 -Mode Visual), while its animation mode steps an explicit caller-owned clock and encodes the resulting frame sequence (-Mode Animation). No editor screenshots or hand-composited UI layers; the only imported artwork is the PurrNet logo used as input for the image-effects loop below.

macOS-inspired native desktop application shell rendered and animated entirely with NowUI

A native desktop-style application shell made from NowUI primitives: animated procedural wallpaper, frosted menu/window/dock surfaces, window chrome, cursor-responsive content, a live control panel, dock magnification, and a texture-backed custom vertex modifier that bends the entire window into its Dock icon and restores it. No OS screenshots or platform artwork.

A now-playing card: transparent album art with a silhouette-hugging glow that morphs into the next track's art on skip, a spinning vinyl with the art rotating on its label, a smooth-unioned equalizer whose bar colors blend, a play button whose icon morphs between triangle and bars, and a heart that fills with a glow burst

A music player card where the SDF image shapes carry the design. The album art is a transparent sprite whose shadow and accent glow follow its silhouette and morph into the next track's art on skip; a vinyl spins behind it with the same art rotating on its label; the equalizer is one smooth-unioned field whose bar colors blend; the play icon morphs between a triangle and two bars; the heart fills with a glow burst. A cursor drives every interaction. SDF Shapes.

A circular month slider: a cursor grabs a white knob and drags it around a gray ring track, a rose-to-crimson progress arc follows it, and the count on the raised center disc ticks from 4 to 9, back to 2, and home again

An Airbnb-style stay-length dial, after the PanGui demo of the same control. The track and the progress arc are each one SDF arc primitive with a texture fill: a conic ramp paints the rose-to-crimson sweep across the arc no matter how far it is dragged, while the inner shadow, emboss, and drop shadow follow the round-capped geometry. The knob lifts and glows while held, and the count slides over on every month boundary. SDF Shapes, Gradients.

A shape-algebra walkthrough: two circles and a triangle are combined step by step through union, intersection, shell, difference, smooth union, and subtraction into a heart, each step named by a syntax-colored code caption, then the heart pulses, wobbles by mixing with an orbiting circle, reacts to a hovering cursor, and morphs back into the opening circle

Shape algebra, after the PanGui "Shapes" demo. Two circles and a triangle are combined one operation at a time (union, intersection, a 10-unit shell, symmetric difference, smooth union, subtraction) until they form a heart. Each caption is the NowUI builder chain that produces that field. Every step change is a distance-field morph with a damped ease, never a crossfade or a slide, and the glossy shading, outline, and drop shadow follow whatever field results: the highlight and shade are ordinary gradients clipped by the scene used as a mask. The captions keep their shared prefix and animate only the new suffix with the built-in FadeUp text animation. SDF Shapes, Masks, Text Animations.

Animated SDF metamorphosis cycling between organic, ticket, and prism forms with contours and lighting

Three unrelated SDF graphs transition through real distance-field morphs — not crossfades — with boolean cutouts, animated contour reveal, warp, emboss, shadow, outline, and glow. The animated field itself is one quad.

A feathered x-ray lens moving over one SDF graph, revealing topographic contours beneath paper-cutout shading

One reusable SDF graph, two custom final-shading materials: a relit paper cutout on the surface and topographic contours beneath a moving feathered analytic mask. Both passes share the identical field; only the final shader and mask coverage differ. SDF Shapes, Masks.

The PurrNet cat logo, a transparent PNG, drawn as an SDF image shape that morphs into an analytic paw print and back while an orbiting drop shadow, pulsing glow, outline, emboss lighting, contour spotlight, and a subtracted circle follow the blended silhouette

An ordinary transparent PNG (the PurrNet logo, the one external image in this README) used as an SDF shape. Its alpha silhouette becomes a GPU-baked distance field, so it morphs into an analytic paw print like any other graph, and shadow, glow, outline, emboss, contours, rotation, and a boolean cut all hug the blended edge. The source texture has no read/write access. SDF Shapes.

Three unrelated textures and an analytic blob merging in one SDF field: a satellite morphs between two sprites while orbiting the PurrNet logo, smooth unions bridge the silhouettes, and fill colors blend across each fillet

Three textures and a shape in one field. The satellite morphs between two sprites while it orbits the logo, smooth unions bridge every silhouette, and the fills crossfade exactly where the geometry does: outside its pixels each image contributes the color of its nearest edge, so fillets and morph bridges never go transparent. Shadow, glow, outline, and emboss shade the merged field.

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.

Native C# previews

The package includes a native CLI for interactive C# apps, stills and animation capture using the same Now / NowLayout API. It reloads source and project assets on save, reads supported Unity assets directly, and renders stock UI, glass and SDF effects in Gamma or Linear color. Agents use this workflow by default. Start with the native preview guide and C# sample. The host requires .NET 9 and OpenGL 3.3; detailed contracts and platform limits are in the maintainer guide.

The optional browser target publishes the same C# scene as a static WebGL2 application, with automatic asset inclusion. Use publish --target web or preview --target web; web builds also require the .NET 9 wasm-tools workload. Native remains the default.

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

An immediate UI library for Unity3D.

Resources

Stars

99 stars

Watchers

2 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages