The following guide shows you the simplest way to display text directly on-screen. You could also follow Expressive Text inside UI if you already have a โmaster UIโ and want to display the text nested to it.
ย
The simplest way to display text directly on screen is using the Blueprint Functions provided:
ย
Hereโs how we use them to display three sentences in subtitle style:
ย
Open the level blueprint (Weโre doing this on the level blueprint but you could do it from any other blueprint)
ย
First, create 3 ExpressiveTextFields variables that are going to contain the 3 different sentences respectively:
And hereโs the value for LineOne:
- Setting Default Style to โSubtitlesโ since thatโs the only style weโre going to apply.
- On Alignment, we set the text to be centered at the bottom and apply a 10% of parent offset from the bottom โ check out Justification, Alignment & Positioning to learn more about how these parameters work.
- Width Settings is set to only occupy 70% of the parent size (i.e. the game screen) so it overflows sooner and doesnโt fill the screen with text from end-to-end.
- Justification is also set to center.
- Finally, we set the text to be whatever we want.
ย
For LineTwo and LineThree we use the same settings as above, changing the text only.
ย
Now itโs time to plug these variables into the macro:
In the macro itself weโre able to define how long to display the text for - something useful about this macro is that it only continues execution when the given time has passed, meaning we can chain them together to transition between sentences.
ย
Now you can hit Play โถ๏ธ and see the results: