Download

Remove All Subtitles Widget

We’ve got a game with narration - there are many places, in which you step in a box and that triggers the next narration line, but the problem is we want to have subtitles too. We use widgets for subtitles - fast and easy to create them. The problem is, that sometimes the new line will start while the old one is still playing, resulting in a subtitles overlap. Voice-wise, we used a concurrency and that worked like a charm - each new line will stop the old one from playing, and the new one would start instead. How would I be able to do that with the subtitles?
I thought of creating a custom node, in which I have a ‘remove from parent’ for each widget, but the problem is, that the ‘remove from parent’ would require me to create the widget first. We cannot use ‘remove all widgets’, because we have other things going on too. I want to create a group of all the subtitle-specific widgets, and to have a node that stops them only. Any way to do that?

If you have a special widget just for your subtitles try a “get all widgets of class”. If you have more then one you can loop through and find out what one you want to keep.

Could you please explain in more detail?

Post a screen shot of how your calling your subtitle widget so I can explain in more context.

2235acd3d6d29d7692f5a3d45efc7bfe63d4e801.png
There it is!

Bump! Anybody please?

There is simple solution…
Create widget “container” and just add only scrollbox to it…
When you overlap something, call this container widget and in it create subtitle widget (line of text) and add it as child of container widget scrollbox…
On event construct you can set timer to widget text line and just try to remove from parent or something like that…

If you dont get it let me know, ill create it and show you bp screen…

I understand what you’re saying, but that won’t automatize it. The whole idea of this thing is to make everything ‘automatic’, example : Line 1 happens. You activate line 2 while line 1 is still playing. Line 1 disappears, line 2 appears. we can simply have a ‘remove from parent’ every time there’s a posibility of overlap, but that means we’ll spend a lot of time thinking which line is after which, etc.

Todor, have you considered using just one widget to display your text? From what I understood (in your very first post), you create a widget every time there is a subtitle to display, which can lead to potential overlapping.

Maybe your dialogue manager blueprint (HUD class, perhaps) can reference the one and only dialogue widget and just swap displayed text as needed. I’ve assumed here that you will have only one conversation happening at a time.

Another solution is to have a Dispatcher fire when a new widget is created telling the already registered elements to remove themselves from the viewport.

That last part, about the dispatcher. How can I make it happen? Thanks.

Here’s a pretty solid post:
https://forums.unrealengine.com/showthread.php?100929-Event-Dispatchers-explained-Finally-!

Again, if you are dealing with a single subtitle at a time, this is probably redundant.