u/_salepaun

▲ 14 r/Unity3D

This whole thing started because I was sick of fighting uGUI for the hundredth time. You know the drill: doing the exact same dance with a HorizontalLayoutGroup, a ContentSizeFitter buried somewhere, slapping a LayoutElement on every single child, and then fighting the anchor math the second the screen size changes. Yes, UI Toolkit exists now, but I honestly just enjoy the uGUI workflow more, and I really didn't want to learn a whole new UI system from scratch since I don't have much web experience.

So I wrote a "small helper script" to drop in and fix it. That was a while ago, and things kind of escalated.

The goal was just to kill the friction. No more anchor math, no chains of fitters, and no need for a LayoutElement on every child. You just drop a single AutoLayout component on an element, tell it how to size itself and how to arrange its children, and you're done.

Under the hood, it uses a two-pass solver based on the Subform layout algorithm (in the same family as morphorm). Instead of relying on CSS-style auto behavior that breaks depending on context, every node declares exactly what it wants to do: Pixels, Hug (wrap children), Fill (stretch to fill remaining space), Percentage, AspectRatio, or TextSize.

It evaluates bottom-up for intrinsic sizes, then top-down to distribute the remaining space. Because nested ContentSizeFitters have a nasty habit of taking 2-3 frames to settle, I pushed the whole solver through Burst. It runs in a single deterministic pass with zero GC allocations and per-axis dirty tracking, meaning you can tweak one value without forcing the entire UI to recompute. (I’m happy to do a deeper dive into the Burst specifics, the data layout, and incremental dirty tracking if anyone's actually interested in the architecture).

Basically, this one component replaces the entire mess of Horizontal/Vertical/GridLayoutGroups, Fitters, LayoutElements, and anchor presets.

A quick rundown of what it actually supports right now:

  • Row, Column, Grid, and Absolute layouts from the exact same component.
  • Six sizing modes per axis (with min/max clamps).
  • Proper CSS Grid support. You can track templates like "200 1f 2f", handle column/row spans, and it does dense/masonry auto-flow.
  • Absolute positioning where you can just pin an element to an edge or stretch it between two, completely skipping standard anchor math.
  • Standard alignment and distribution (start/center/end, space-between/around/evenly).

There are a ton of other features and edge-case handlers I haven't covered here, but that gives you the high-level picture.

I'm mostly posting this to gauge interest and get some feedback. I have three questions for you guys:

  1. Is this something you'd actually want to drop into your projects and try out?
  2. What is the absolute worst UI/layout headache you constantly run into with Unity?
  3. What else would a tool like this need for you to actually use it? Anything obvious I missed?
u/_salepaun — 4 months ago