Safe area, breakpoints, orientation, aspect ratio, and platform-aware styling for Unity UI Toolkit. One drop-in component, five demo scenes, zero hard dependencies.Unity's UI Toolkit ships with Flexbox but no breakpoint system, no safe area handling, no orientation classes, and no platform-aware styling. Developers ship layouts that overlap iPhone notches, snap awkwardly at every screen size, and require manual Screen.safeArea coordinate inversion code in every project.This asset is the missing layer. Drop a single ResponsiveManager component on your UIDocument and your panel gains automatic USS classes for breakpoints, orientation, platform, notch presence, and the iPhone Duo fold. A SafeAreaContainer custom element insets content from the notch and home indicator wherever you place it.Works on every screen.SafeAreaContainer wraps any subtree and applies the correct padding for the current device's notch, home indicator, and camera cutouts. Per-edge masking lets you opt into individual edges (top-only, horizontal-only, etc.). A minimum-padding fallback keeps non-notched devices comfortable. Nested SafeAreaContainers detect each other and avoid double-padding. Works correctly under any PanelSettings scale mode — Constant Pixel Size, Scale With Screen Size, or Constant Physical Size — with automatic panel-to-screen scale correction.Breakpoints that actually adapt.Drop in the default BreakpointProfile (phone-portrait, phone-landscape, tablet, desktop) or define your own. The ResponsiveManager applies a USS class to the document root on every breakpoint change so your stylesheets just work. Write code-level reactions with WhenBreakpoint("desktop", active => …) returning IDisposable handles, or mark methods with the [ResponsiveCallback] attribute and have them auto-invoked. Swap entire UXML templates per breakpoint via BreakpointTemplateSwapper with a re-binding event for any data already wired up.Layouts that follow the iPhone Duo hinge.Bend an open iPhone Duo and your UI can split along the hinge. Hold it upright and bend it like a small laptop: a map fills the top half and its controls sit on the bottom. Turn it sideways and the halves sit left and right like an open book, say a board game beside its move list. Lay the phone flat and the two halves join into one screen again; fold it shut and your layout follows the app onto the outer display. Responsive Layout reports each of these changes as an event, so your layout code reacts instead of polling.Unity has no fold or hinge API, so Responsive Layout supplies one. ResponsiveManager.CurrentFold tells you whether the app spans the fold, the posture (closed, open, partly open), the live hinge angle, and the rect of each half in panel, screen, and viewport coordinates. FoldChanged and WhenSpanned fire when the layout should change.FoldPanes lays two content slots over the two halves with the fold as the gap, from C# or UXML. When the app is not spanned, it stacks both slots or shows only one..fold-spanned, .fold-vertical, .fold-horizontal, .fold-closed and the other .fold-* classes land on the document root, so a stylesheet can restyle the layout with no C#.With the native source, HingeAngleChanged streams the angle from 0 (shut) to 180 (flat), separate from FoldChanged so layout code does not rebuild on every degree. The Fold demo rolls a ball with it.Assign a half's viewport rect to Camera.rect and a camera renders into that half alone.On iOS 27.1 and newer, in a player built with Xcode 27.1 or newer, the native source reads Apple's hinge and fold region. It shows two halves only while iOS reports a fold region: on the device that starts after the phone is bent down from flat and ends when it is flat again or shut, so a flat phone shows one pane. The size-based source splits the inner display at any angle and takes over wherever the native source is unavailable; assign it yourself if you want halves on a flat phone. Other foldables plug in through IFoldSource.No Duo on your desk? The Fold section of the Responsive Layout Preview window drives the spanned state, posture, fold line, and hinge angle in Play Mode, and Install Example Device Profiles adds iPhone Duo inner and outer profiles to the Device Simulator. Fold support is tested in the Unity Editor, on the iPhone Duo simulator (iOS 27.2), and on a physical iPhone Duo (iOS 27.2.1), upright and sideways.Six demo scenes included.Safe Area (visualize notch padding and cycle edge configurations), Breakpoint (three-column adaptive layout that morphs from single column on phone to sidebar + main + secondary on desktop), Orientation (portrait/landscape reflow), Aspect Ratio (16:9 / 4:3 / 1:1 / 9:16 cycling against all four fit modes), Platform Styles (touch vs pointer button sizing), and Fold (the fold state in one half of an iPhone Duo and a ball that rolls with the hinge angle in the other). Every scene opens and plays as shipped, with its controller script and USS alongside.Aspect ratio and platform detection.AspectRatioContainer keeps video players, image previews, and any fixed-ratio content correctly framed regardless of container size — four fit modes (Contain, Cover, WidthBased, HeightBased) cover every real use case. PlatformDetector applies thirteen USS classes for OS, device category, touch capability, and notch presence so you can branch styling on .platform-ios, .has-touch, .has-notch, and more — all from your stylesheet, no C# branches.Works with UI Toolkit: Tween Engine.When you own UI Toolkit: Tween Engine, open Tools > KrookedLilly > Setup and enable the Tween Engine → Responsive Layout integration. Two extensions light up. Smoothly interpolate an AspectRatioContainer between ratios instead of snapping — useful for hero panels that morph between 1:1 on phone and 16:9 on tablet:hero.TweenAspectRatio(16f / 9f, duration: 0.3f);And fade the new template into a BreakpointTemplateSwapper on each breakpoint change so layout swaps feel less abrupt:swapper.AddFadeInAnimation();Both fall back to instant transitions when the integration is off.Full C# source, no DLLs.XML documentation on every public API. Works with both Unity's Legacy Input Manager and the new Input System package. Zero hard dependencies.Safe AreaSafeAreaContainer custom VisualElement with UXML supportPer-edge masking: All, Top, Right, Bottom, Left, Horizontal, Vertical, NoneMinimum-padding fallback for non-notched devicesNested-container no-op detection prevents double-paddingAutomatic panel-to-screen scale correction under any PanelSettings scale modePeriodic refresh catches multitasking resize, foldable unfold, iPad Split View, and rotationSafeAreaCalculator static utility for direct insets math (bottom-left to top-left coordinate inversion)BreakpointsBreakpointProfile ScriptableObject with default phone-portrait / phone-landscape / tablet / desktop presetsExplicit Priority field for deterministic resolution of overlapping rangesOptional orientation constraints per breakpointBreakpointTemplateSwapper component for per-breakpoint UXML template swaps with TemplateChanged eventWhenBreakpoint(name, Action) returns IDisposable for safe per-breakpoint subscriptions[ResponsiveCallback("name")] attribute + ResponsiveCallbacks.Register reflection helper, IL2CPP-safeOrientationPortrait / Landscape detection from current screen dimensions.orientation-portrait and .orientation-landscape USS classes auto-applied to rootSquare-aspect tie-break favors Landscape to prevent jitter at exactly 1:1Foldables (iPhone Duo)ResponsiveManager.CurrentFold (FoldState): IsSpanned, Posture, Axis, Source, HingeAngle, FoldRect, and each half in panel, screen, and viewport coordinatesFoldChanged, HingeAngleChanged (kept separate so layout code does not rebuild on every angle update), and WhenSpanned(Action) returning IDisposable.fold-spanned, .fold-vertical, .fold-horizontal, .fold-closed, .fold-open, .fold-partly-open USS classes on the document rootFoldPanes UXML element with First and Second slots and a single-pane mode (Stack, FirstOnly, SecondOnly)Native iOS source (iOS 27.1+, Xcode 27.1+) with hinge angle and partly open posture; size-based source for older iOS; IFoldSource for your ownFold calculation, size-based reads, and pane rect queries do not allocateAspect RatioAspectRatioContainer custom VisualElement with UXML supportFour fit modes: Contain (letterbox), Cover (crop-to-fill), WidthBased, HeightBasedGeometry-event driven — recalculates only on layout changePlatform DetectionThirteen USS classes covering OS, device category, touch capability, and notch presence.platform-ios, .platform-android, .platform-windows, .platform-macos, .platform-linux, .platform-webgl, .platform-mobile, .platform-desktop, .platform-editor, .has-touch, .no-touch, .has-notchNotch detection inferred from Screen.safeArea — works even on devices with no first-class APIUtilitiesResponsiveValue with .Bind(manager, onChanged) for declarative per-breakpoint valuesResponsiveSpacing scale (Xs, Sm, Md, Lg, Xl) tuned per breakpoint categoryShowOnBreakpoint / HideOnBreakpoint extension methods with IDisposable handlesEditorCustom ResponsiveManager inspector with embedded UIDocument foldout and live runtime state panelHideFlags three-layer pattern prevents Unity's known MissingReferenceException on play-mode exitWorks cleanly across domain reloads and play-mode transitionsResponsive Layout Preview window with a Fold section: override the spanned state, posture, fold line, hinge angle (0 to 180), and fold width in Play ModeInstall Example Device Profiles adds Device Simulator profiles for the iPhone Duo inner and outer displays, a Samsung Fold, and iPad Split ViewIncluded demosSafeAreaDemo: full-screen unsafe-zone overlay with cycle button for edge configurationsBreakpointDemo: three-column adaptive layout from single column on phone to sidebar + main + secondary on desktopOrientationDemo: content reflows from single-column stack in portrait to side-by-side row in landscapeAspectRatioDemo: 16:9 / 4:3 / 1:1 / 9:16 ratio cycling against all four fit modesPlatformStylesDemo: touch vs pointer button sizing demonstrates .has-touch and .platform-mobile class applicationFoldDemo: FoldPanes with the posture, spanned state, source, and hinge angle in the first half, a ball that rolls with the hinge angle in the second, and an optional camera assigned to the second halfCompatibilityUnity 6.3 LTS (6000.3) or newerUI Toolkit (com.unity.modules.uielements)Native fold source: iOS 27.1 or newer, in a player built with Xcode 27.1 or newerFold support tested in the Unity Editor, on the iPhone Duo simulator (iOS 27.2), and on a physical iPhone Duo (iOS 27.2.1)Full C# source, no DLLsXML documentation on all public APIsZero external dependenciesAI (Claude Code) was used as a development assistant throughout the package creation process. This includes code generation, architecture design, writing unit tests, documentation authoring, and debugging. All AI-generated code was reviewed, tested, and validated by the developer. The final package is 100% human-supervised C# source code with no AI runtime components.






