How do I Limit the number of rows in a UMG Text Widget?

What I’d like is for each time the text wraps to a new line, for that new line to appear at the bottom while the 3 above it each move up one row, with the top line being pushed out / disappearing. See these old games for a demonstration:

Can a Text Widget in Unreal Engine be made to do that?

The link does not work.

It can be done, you’d need to prepare the lines of text upfront or code a method that grabs just enough text (char count may work fine) from a string and chops it. And then:

  • create a widget that represents a line of text
  • keep adding those widgets to a Scroll Box
  • scroll to the bottom after adding each line

Have a look at my post here; there’s a vid attached to demo what it does. Hope that’s it.


Alternatively, although untested, accumulating text in a single Text Block sitting at the bottom of a Scroll Box and relying on the automatic line-breakes could also work OK - worth trying. You may need to force a layout prepass to avoid text rejiggling as its desired size changes.

1 Like

Fixed the links. I will check out both methods next time I work on it. Thanks!

That looks like what I’m after. Did you build and test that just now?

Alternatively, although untested,
accumulating text in a single Text
Block sitting at the bottom of a
Scroll Box and relying on the
automatic line-breakes could also work
OK - worth trying. You may need to
force a layout prepass to avoid text
rejiggling as its desired size
changes.

This method seems to work just fine, with little fuss. Again, it all depends what and how we’re chopping the text:

Image from Gyazo

Was sitting at back of my head. I’ll post it later.

For X characters added at a time:

For sentences, providing they end with a full stop (or, better, use a custom delimiter):

329352-widget.jpg

1 Like

Worked perfectly! Thanks for everything!