Skip to content

kids.kapish.flexui.urp

unity

Universal Render Pipeline renderer for FlexUI. Hooks into URP's RenderGraph for runtime rendering and provides a full scene preview system for the editor.

Installation

Add to Unity project manifest alongside kids.kapish.flexui:

json
{
  "kids.kapish.flexui.urp": "file:../../src/unity/kids.kapish.flexui.urp"
}

Architecture

Render Pipeline Integration

FlexRendererURPFeature is a ScriptableRendererFeature that creates a FlexRendererURPRenderPass. The pass uses Unity's RenderGraph API - it attaches to the camera colour texture and executes a callback that renders all FlexUI visuals via CommandBuffer.

The feature auto-registers at editor startup: FlexRendererURPStartup checks if URP is the active pipeline and calls FlexRenderer.Register(). The setup menu item (Tools → FlexUI → Install URP Renderer Feature) programmatically adds the feature to the URP renderer data asset.

Scene Preview

FlexRendererURPScenePreview hooks into SceneView.duringSceneGui and:

  1. Runs FlexLifecycle.RunLayout() on every root canvas
  2. If Show Visuals: renders each IFlexRenderable via CommandBuffer.DrawMesh() with a MaterialPropertyBlock carrying flex width/height
  3. If Show Layout: draws margin/content/padding rects as wireframe overlays via Handles.DrawAAPolyLine()

Coordinate conversion uses FlexSpatial.CanvasToScene() and FlexSpatial.CanvasToSceneViewCamera() to map flex space to Unity world/screen space.

Preview Controls

FlexRendererURPSceneToolbar is a Scene view Overlay with three toggles backed by PreviewSettingsData on the feature asset. FlexRendererURPSceneHeartbeat triggers continuous SceneView.RepaintAll() when Play Always is enabled.

Dependencies

DependencyKind
kids.kapish.flexuiruntime
com.unity.render-pipelines.universal 17.0.0+runtime

Build

Import via Unity Package Manager. Requires Unity 6000.0+.


Usage Guide

URP integration for FlexUI - render feature, scene preview, and editor toolbar.

Setup

  1. Add kids.kapish.flexui.urp to your project manifest.
  2. Run Tools → FlexUI → Install URP Renderer Feature - this adds the FlexRendererURPFeature to your URP pipeline asset.
  3. The renderer auto-registers at editor startup. Check the console for "FlexUI: FlexRendererURPFeature is not enabled" if something's wrong.

Scene Preview

Open any scene with a FlexCanvas and use the Flex UI overlay in the Scene view:

  • Show Layout - wireframe rects showing margin, content, and padding for every node
  • Show Visuals - renders images, panels, and materials directly in the Scene view
  • Play Always - continuous refresh for previewing animations or dynamic content

Tips

  • Only install one render pipeline package - URP, HDRP, or BiRP, matching your project.
  • The render feature must be on the active renderer - if you have multiple URP renderer assets, install the feature on each one you use.

Carrot