UDialoguePlayerBase
Overview
UDialoguePlayerBase is an abstract base class designed to manage the lifecycle of dialogue playback. It includes methods for playing, finishing, and stopping dialogues, as well as subscribing to events when a dialogue finishes. This class ensures that all necessary cleanup is handled properly by overriding BeginDestroy.
Properties
Type | Name | Access | Description |
|---|---|---|---|
TWeakObjectPtr | DialogueData | Private | Weak pointer to the dialogue data being played. |
FDialogueEvent | OnDialogueFinished | Public | Multicast delegate that is broadcast when a dialogue finishes playing. |
TOptional | bHasFinished | Private | Optional boolean indicating whether the dialogue has finished playing. |
FGuid | PlayerId | Public | Unique identifier for the dialogue player. |
Functions
Return Type | Signature | Description |
|---|---|---|
void | BeginDestroy() override | Called when the object is about to be destroyed. Ensures that the subsystem knows when to clean up dialogue players. |
void | PlayDialogue(const UDataTable* InDialogueData) | Starts playing a new dialogue using the provided dialogue data. |
void | FinishPlayDialogue() | Marks the current dialogue as finished and broadcasts the |
void | StopDialogue() | Stops the currently playing dialogue (currently does nothing). |
const UDataTable* | GetDialogueData() const | Returns the current dialogue data being played. |
FGuid | GetPlayerId() const | Returns the unique identifier for this dialogue player. |
Usage & Implementation Notes
Threading Constraints: This class is not thread-safe and should be used on the game thread.
Replication Requirements: None.
Memory Lifetime Management: The
DialogueDatais managed using a weak pointer to avoid memory leaks. Ensure that the dialogue data remains valid for the lifetime of the dialogue player.Initialization Dependencies: The
PlayerIdis initialized in the constructor, ensuring each instance has a unique identifier.