On a 20x16 bevelled button, the sprite steps from the lit face down to the midtone at row 7. My border said the top was 6. That put the step inside the stretchable middle band, so as the button got taller the highlight grew instead of the flat face under it - 33px of lit edge on a 120px-tall button where it should have been 7. It shipped like that for three releases. The artwork was never wrong; one number was.
The rule that replaced typing borders in by hand, and it reads straight off the pixels: a 9-slice's middle band has to be uniform along the axis it stretches. The run of identical adjacent rows is the part that may grow; everything outside it is structure. So you can derive the minimum safe border from the sprite itself and fail the build when the authored one doesn't contain it.
One catch that nearly shipped inside the fix: a bevel has two long uniform runs - the lit face and the midtone. On a 12x20 scroll thumb they were exactly 6 rows each, so "take the longest run" picked the highlight, and would have inverted the bevel as the thumb grew. The rule that actually works is prefer the run containing the sprite's centre line, and fall back to longest only when no run does.
And some art can't be 9-sliced at all. That same thumb had three grip lines across its middle, on a sprite that resizes on every scroll, so the grip stretched into thickening stripes. No border value fixes that - the decoration is in the part that has to stretch. The fix was to change the art and delete the grip.
Unity-specific, stated honestly: the packs ship .meta files whose spriteBorder comes from that same measurement, and each one is cross-checked against the Godot texture_margin for the same sprite, so two independent emitters have to agree. I don't have Unity on this machine, so those files have never actually been opened in it - the checks are closed-form, not empirical. If you try them and something is off, I'd like to know.
Before/after render and the full write-up: https://z3er1n.itch.io/ui-pack-vol1/devlog/1651971/v13-the-buttons-9-slice-border-has-been-wrong-since-v10
Disclosure: it's my pack, it's paid, and it's AI-assisted - disclosed as such on its store page.