Hi, I’m currently using UMG to create my subtitle/NPC dialogue system.
For now, my block of text simply fades in and out, but I was wondering if there’s any way to animate my text widget so that the contents look like they’re getting typed out?
There is no need for the blinking underscore behind it, but i just want it to roll out naturally instead of showing a giant block of text right away.
Any help, demos or guidance is appreciated. Thanks!
Here is the basics:
Take your Completed string, pass it into a For Loop(last index determined by passing the completed string into LEN, first index is just 0)
The loop should contain: LEFT(your completed string feeds into this, also the “Index” from the for loop feeds into it) and then a pause of 0.1 seconds or similar.
effectively each time around the loop it adds one more letter to the length of the output string.
This should be responsible for updating the UMG widget variable that feeds on screen display.
in the completed part of the for loop, i’d add a delay of a second or so, and then remove the UMG widget.
Thanks! that makes a lot of sense and helped me greatly.
However, I’ve run into a problem as my string still prints as one sentence instantly. I put a print string at the end of every loop for debug, and realized that it was only called once with the whole string printed.
hmmm. maybe i’m being stupid with the for loop, it seemed the most logical. after a bit of checking the for loop runs through all iterations in the space of one tick. which explains what you are seeing.
this isn’t a problem, it just makes things a little more interesting.
similar approach, just varied slightly.
it would need to be done using event tick and a series of variables for doing making your own for loop.
like set textindex=0, (do the len, left stuff here) then set textindex=1, delay 0.1 (event tick will obey this delay) and repeat - you will need a variable to store the string length and compare textindex to it.