Help with text wrapping with a dialogue system

I am currently building a basic dialogue system where the text types out one letter at a time.

The only issue I currently have is that if a word is too large as it fills out it will jump down to the next line
which looks bad in game. The dialogue box would have a fixed width so is there any way to detect the text
width and force it to word wrap early? The dialogue box is a Text Block on the HUD.

Bump, perhaps there’s a better way to do this than with a Text Block?

Hello,
If a basic system without any word cut precision is ok for you, you can use an integer variable. When your variable = max length - 1 : you add a -, do return and reset variable. If you want fair word cut it will need a lot more work.

Edit : I forgot spaces. You’ll have to do a check on space before doing return or not. if space then return without -