Click here to return to table of contents.
Dialogue Tree: Dialogue Speaker Component
Extends: UAudioComponent
A component representing a “Speaker” or participant in a dialogue. Serves as a liaison between the dialogue and the game world, as well as playing any actual audio clips.
Contents
- Blueprint Callable Methods
- Set Display Name
- Set Dialogue Name
- Get Display Name
- Get Dialogue Name
- Set Owned Dialogue
- Get Owned Dialogue
- Get Gameplay Tags
- Start Owned Dialogue With Names
- Start Owned Dialogue
- Start Dialogue With Names
- Start Dialogue
- Start Owned Dialogue With Names At
- Start Owned Dialogue At
- Start Dialogue With Names At
- Start Dialogue At
- End Current Dialogue
- Try Skip Speech
- Blueprint Implementable Methods
- Data Attributes
1. Blueprint Callable Methods
The following methods can be called but not overridden via blueprint.
Set Display Name (BlueprintCallable)
/**
* Sets the speaker's display name to the provided text.
*
* @param InDisplayName - FText, the new display name.
*/
void SetDisplayName(FText InDisplayName);
Set Dialogue Name (BlueprintCallable)
/**
* Sets the speaker's dialogue name (the name to use for matching it
* automatically into a dialogue role).
*
* @param InDialogueName - FName, the new dialogue name.
*/
void SetDialogueName(FName InDialogueName);
Get Display Name (BlueprintCallable, Pure)
/**
* Retrieves the display name for the speaker.
*
* @return FText, the display name.
*/
FText GetDisplayName() const;
Get Dialogue Name (BlueprintCallable, Pure)
/**
* Retrieves the dialogue name for the speaker. This is used for matching
* the speaker component to its role in a dialogue.
*
* @return FName - the speaker's dialogue name.
*/
FName GetDialogueName() const;
Set Owned Dialogue (BlueprintCallable)
/**
* Sets the speaker's owned dialogue to the provided dialogue asset.
*
* @param InDialogue - UDialogue*, the target dialogue.
*/
void SetOwnedDialogue(UDialogue* InDialogue);
Get Owned Dialogue (BlueprintCallable, Pure)
/**
* Retrieves the speaker's owned dialogue.
*
* @return UDialogue*, the owned dialogue.
*/
UDialogue* GetOwnedDialogue();
Get Gameplay Tags (BlueprintCallable, Pure)
/**
* Gets gameplay tag container for any ongoing speech.
*
* @return FGameplayTagContainer
*/
FGameplayTagContainer GetGameplayTags();
Start Owned Dialogue With Names (BlueprintCallable)
/**
* Starts the default dialogue for this speaker component. Uses the provided
* name-speaker pairings for matching with target dialogue.
*
* @param InSpeakers - TMap<FName, UDialogueSpeakerComponent*>,
* the speaker components to pass to the dialogue.
* @param bResume - bool, If true will resume dialogue from the marked resume
* node (if any). If false will start dialogue from the beginning. Defaults to
* false.
*/
void StartOwnedDialogueWithNames(TMap<FName, UDialogueSpeakerComponent*> InSpeakers,
bool bResume);
Start Owned Dialogue (BlueprintCallable)
/**
* Starts the default dialogue for this speaker component. Attempts to
* match the provided speaker's dialogue names to those expected
* by the dialogue. Duplicate or unfilled names not allowed.
*
* @param InSpeakers - TArray<UDialogueSpeakerComponent*>, the conversing
* speakers.
* @param bResume - bool, If true will resume dialogue from the marked resume
* node (if any). If false will start dialogue from the beginning. Defaults to
* false.
*/
void StartOwnedDialogue(TArray<UDialogueSpeakerComponent*> InSpeakers, bool bResume);
Start Dialogue With Names (BlueprintCallable)
/**
* Starts the given dialogue. Uses the provided name-speaker pairings for
* matching with target dialogue.
*
* @param InDialogue - UDialogue*, the dialogue to start.
* @param InSpeakers - TMap<FName, UDialogueSpeakerComponent*>,
* the speaker components to pass to the dialogue.
* @param bResume - bool, If true will resume dialogue from the marked resume
* node (if any). If false will start dialogue from the beginning. Defaults to
* false.
*/
void StartDialogueWithNames(UDialogue* InDialogue,
TMap<FName, UDialogueSpeakerComponent*> InSpeakers, bool bResume);
Start Dialogue (BlueprintCallable)
/**
* Starts the given dialogue. Uses the provided speakers' dialogue names
* for matching with target dialogue. Duplicate or unfilled dialogue names
* not allowed.
*
* @param InDialogue - UDialogue*, the dialogue to start.
* @param InSpeakers - TArray<UDialogueSpeakerComponent*> the conversing
* speakers.
* @param bResume - bool, If true will resume dialogue from the marked resume
* node (if any). If false will start dialogue from the beginning. Defaults to
* false.
*/
void StartDialogue(UDialogue* InDialogue, TArray<UDialogueSpeakerComponent*> InSpeakers,
bool bResume);
Start Owned Dialogue With Names At (BlueprintCallable)
/**
* Starts the default dialogue for this speaker component at the given
* NodeID location. Uses the provided name-speaker pairings for matching
* with target dialogue.
*
* @param InNodeID - FName, the target node ID to start at.
* @param InSpeakers - TMap<FName, UDialogueSpeakerComponent*>,
* the speaker components to pass to the dialogue.
*/
void StartOwnedDialogueWithNamesAt(FName InNodeID,
TMap<FName, UDialogueSpeakerComponent*> InSpeakers);
Start Owned Dialogue At (BlueprintCallable)
/**
* Starts the default dialogue for this speaker component at the given node
* ID. Attempts to match the provided speaker's dialogue names to those
* expected by the dialogue. Duplicate or unfilled names not allowed.
*
* @param InNodeID - FName, the target node to start at.
* @param InSpeakers - TArray<UDialogueSpeakerComponent*>, the conversing
* speakers.
*/
void StartOwnedDialogueAt(FName InNodeID, TArray<UDialogueSpeakerComponent*> InSpeakers);
Start Dialogue With Names At (BlueprintCallable)
/**
* Starts the given dialogue at the given node ID. Uses the provided
* name-speaker pairings for matching with target dialogue.
*
* @param InDialogue - UDialogue*, the dialogue to start.
* @param InNodeID - FName, the target node to start at.
* @param InSpeakers - TMap<FName, UDialogueSpeakerComponent*>,
* the speaker components to pass to the dialogue.
*/
void StartDialogueWithNamesAt(UDialogue* InDialogue, FName InNodeID,
TMap<FName, UDialogueSpeakerComponent*> InSpeakers);
Start Dialogue At (BlueprintCallable)
/**
* Starts the given dialogue at the given node ID. Uses the provided
* speakers' dialogue names for matching with target dialogue. Duplicate
* or unfilled dialogue names not allowed.
*
* @param InNodeID - FName, the target node to start at.
* @param InDialogue - UDialogue*, the dialogue to start.
* @param InSpeakers - TArray<UDialogueSpeakerComponent*> the conversing
* speakers.
*/
void StartDialogueAt(UDialogue* InDialogue, FName InNodeID,
TArray<UDialogueSpeakerComponent*> InSpeakers);
End Current Dialogue (BlueprintCallable)
/**
* Ends the dialogue the speaker is currently participating in, if applicable. Does nothing
* if the speaker is not engaged in dialogue.
*/
void EndCurrentDialogue();
Try Skip Speech (BlueprintCallable)
/**
* Attempts to skip the current speech that is playing. Does nothing if the
* speaker component is not engaged in dialogue.
*/
void TrySkipSpeech();
Note: A common issue encountered here occurs when game input is set to not be allowed in the project settings. This blocks all input, which prevents TrySkipSpeech() getting called. You can bypass this restriction in one of two ways. Either allow game input while in dialogue, or implement an override of OnKeyDown() or OnMouseDown() in a custom Dialogue Widget.
2. Blueprint Implementable Methods
The following methods can have their behavior implemented or altered in blueprints.
Play Speech Audio Clip (BlueprintNativeEvent)
/**
* Plays the given audio clip. Exposed to blueprint to be
* user-overridable.
*
* @param InAudio - USoundBase*, the audio clip.
*/
void PlaySpeechAudioClip(USoundBase* InAudio);
3. Data Attributes
Data attributes associated with the class.
Display Name (EditAnywhere, BlueprintReadWrite)
- Type: FText
- Access: Protected
- Description: The name to display for this speaker in dialogue.
Dialogue Name (EditAnywhere, BlueprintReadWrite)
- Type: FName
- Access: Protected
- Description: The “key” name used to match the speaker to its dialogue role.
Owned Dialogue (EditAnywhere, BlueprintReadWrite)
- Type: UDialogue
- Access: Protected
- Description: The default dialogue to start when initiating dialogue.
Gameplay Tags (BlueprintReadOnly)
- Type: FGameplayTagContainer
- Access: Protected
- Description: Tags associated with the current speech in dialogue. Used for animation, etc. Updated for every new speech. Makes use of Unreal’s GameplayTag system.
- Note: The built in GameplayTag system is excellent and very flexible. Unfortunately, it’s not as widely publicized as it deserves, so it’s possible that some users will not know about it. In general I tried to keep to systems that the average Unreal user will know, but in this case I decided that GameplayTags offer enough extra flexibility to be worth the risk that some users might not immediately understand what they’re looking at. If you’re not already familiar with these they’re well worth the short time it takes to learn them.
On Gameplay Tags Changed (BlueprintAssignable)
- Type: FOnGameplayTagsChanged
- Access: Public
- Description: Delegate used to let others know when gameplay Tags change. Takes an event/function whose parameter is an FGameplayTagContainer representing the new tags for the speaker’s current speech.
On Speech Skipped (BlueprintAssignable)
- Type: FSpeakerSpeechSignature
- Access: Public
- Description: Delegate used to let others know when this speaker’s speech was skipped.