Is there any way of creating proper UMG Subtitles?

Hello again, I was wondering if the is a proper way to make subtitles in UMG instead of relying on the Dialogue as my project doesn’t even have voices, I’ve tried to do with the function binding, but functions will act immediately unless you delay based+Set Visibulity on the Widget at the Event Graph, meaning that things such as subtitles would take a hell load of copy paste in the Design editor and then in the Event Graph.

Appearently for some reason, the Draw Text is not working as the Tesla Dev Tutorial back in the U4 young days.

I know that there is the Dialogue Assets, but just as another used questioned once, what if I have many of them? Also, how I would even try to delay a bit the Play Dialogue?

Yes you can and there is plenty of ways to do so.

The most basic one: create a Widget/UMG with a text (palette/common/text), bind the value of this text to a function and more precisely a variable (the bind button is on the right of the input field where you can enter your text).

Then, attach this widget to the viewport, and when you need to display a message, simply change the content of this text variable.

If you want it to work in VR, then instead of attaching the widget to viewport, you have to create a 3D widget and place it for instance in front of your camera, so it stays at a precise relative location from your character/pawn.

However, if you have seen my other post on the subject, don’t expect to have subtitles working in VR during matinee/sequencer. Well, you always can but you would be using trashy tricks / sticking plaster solutions.

PS: you can also look at the marketplace, for instance for the UI Notification system of panda

1 Like

The problem is that the binded function will act just as you start the game, instead of playing in specific points or time delay.

It is a binding function, so when you change its associated variable, it will change the text displayed at any time in the game.

Also, most subtitles in a game should be event-driven to avoid desynchronization between player location/view and the display of messages.

If you still want a time-driven subtitle, it is still very possible, you just have to use a set timer function that will trigger at a specific time the change of the variable in your binding function (hence changing the displayed text)

1 Like

Okay, I’ve managed to do a Subtitle change at the Widget BP, however, when I decide to move it’s contents to a Trigger Box, and bind the UMG Text to the Get_Text_0(Pure too) from the TriggerBox to play when I overlap, it doesn’t do anything, yet, it will play automatically if I do it from the player BP.

I’ve made a comment above

“Okay, I’ve managed to do a Subtitle change at the Widget BP, however, when I decide to move it’s contents to a Trigger Box, and bind the UMG Text to the Get_Text_0(Pure too) from the TriggerBox to play when I overlap, it doesn’t do anything, yet, it will play automatically if I do it from the player BP.”

The answer to your question is YES, there is a way, but you need to go into c++ to do it. Long story short there are three steps to accomplish this.

1). You need to expose a certain delegate in the AudioComponent.h to multicast in order to allow it be exposed in BP by making it of type BlueprintAssignable.

DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams( FOnQueueSubtitles, const TArray<struct FSubtitleCue>&, Subtitles, float, CueDuration );

UPROPERTY(BlueprintAssignable)
FOnQueueSubtitles OnQueueSubtitles;

Those are the two relevant lines in AudioComponent.h

2). Now that you’ve done that you need to go in and change the call of that delegate in SubtitleManager.cpp to be .Broadcast instead of .CallIfBound

AudioComponent->OnQueueSubtitles.Broadcast(QueueSubtitleParams.Subtitles, QueueSubtitleParams.Duration);

3). The third and final step involves being able to use the FSubtitleQue Struct in blueprints. You can do this by going into EngineTypes.h and changing it to be a USTRUCT(BlueprintType) and then setting the values inside to be UPROPERTY(EditAnywhere, BlueprintReadWrite)

USTRUCT(BlueprintType)
struct FSubtitleCue
{
	GENERATED_USTRUCT_BODY()

	/** The text to appear in the subtitle. */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=SubtitleCue)
	FText Text;

	/** The time at which the subtitle is to be displayed, in seconds relative to the beginning of the line. */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=SubtitleCue)
	float Time;

	FSubtitleCue()
		: Time(0)
	{ }
};

Now that you’ve done all this, you can go into blueprints and use the delegate OnQueueSubtitles to do stuff with the subtitles that are called when an AudioComponent plays anything with a subtitle set. Be careful if you are using SoundWaves with multi-line subtitles, as you will need to write you own logic to allow for them to be displayed at the proper times. I highly recommend look at this post’s answer to understand how that behaves.

You will need to change your text binding in your UMG widget to show the next line after X seconds where X requires some recursive math (for all but the first line, display the next line after Time - LastNodesTime).

Let me know if you have any more questions.

UE4, please, please for the love of god start exposing subtitle system stuff so people can use it in blueprints. Having to go into c++ to change where text is displayed or to setup binding delegates is just not cool.