[Tutorial] Automatic String line Break on the first Space Found at a Custom Length

This is how I did for a String be Break in lines with custom size. I made a Blueprint Function Library and Added the Function them all Widget may call it.

Original Text = Text
Lengh to Break = Number of Letter to count until the Break

Explanation: It will see the size of the String, if it is Bigger than the Length you sent, it will search the first space between the Length and the Start and will added that part to a Variable with a ‘Shift+Enter’ to Break the Line.

First Branch: Don’t break if the text is too small.
Second Branch: Based on ‘Len Variation’(Set as 5), it verify if the space is too far from the break point (5 characters in the case).
The Last Branch is don’t add a Break in the top of the first Line.

This is how it Look when Called




Probably you can reduce the size.

Update: Simplified some of the code and added Len Variation that make it break in the middle of the world if no space was found.

Edit: Fixed small issue.

Thanks for sharing!

I was looking for that in the builtin blueprint widget.
I’ll definetly try yours!