UGTK cat mascotUGTKengine within an engine Request access

UGTK / Toolkit / Ui Module / TMP Line Balancer Completed

Ui Module — UGTK

TMP Line Balancer

Summary

Mn_TMPTextHardLineBalancer re-flows a TextMeshProUGUI string into a fixed (or ranged) number of visually balanced lines by inserting hard newlines at word boundaries. It normalizes spaces, strips existing newlines, and enforces NoWrap + a chosen overflow mode so TMP never adds extra lines on its own.


Content


Modules Dependencies

This module has no hard UGTK dependencies. It requires TextMesh Pro (TMPro).


Setup

Drop the Text_LineBalancer prefab under a Canvas — a TMP label with the balancer already attached:


How To Use

Good to know:


Testing Scene

Open Debug/TMPLineBalancerScene.unity: the same sentence is shown balanced over a different number of lines, so the effect of lineMode and centerBias is visible side by side.


Technical Info


© 2026 Marcello De Bonis. All rights reserved