There are three main ways to communicate between Actors in Blueprint: "Direct Reference," "Blueprint Interface," and "Event Dispatcher."
This article explains the characteristics and proper usage of these three communication methods.
Direct Reference
Overview and Usage
Direct Reference is the simplest and most intuitive communication method. It directly calls variables or functions of a specific Blueprint class—giving a clear instruction like "execute this function of this Actor."
Use Cases:
- Player character calling the
OpenDoorfunction of a specific "Door" Actor in front of them. - Parent class directly changing properties of a child class's specific Component.
Blueprint Example (Player to Door Reference):
- Store a reference to the Door Actor (
BP_Door) in a variable in the Player Actor (BP_Player) (e.g., duringBeginPlayorOverlapevent). - Pull a pin from that variable and directly search for and execute the desired function (e.g.,
OpenDoor).
// BP_Player Event Graph
// Reference Variable: TargetDoor (Type: BP_Door)
If TargetDoor Is Valid:
Call TargetDoor.OpenDoor()
Pros and Cons
| Pros | Cons |
|---|---|
| Easy implementation, low learning curve. | High dependency (Tight Coupling). |
| Good performance. | When referenced Actor changes, referencing side needs modification. |
| Processing flow is easy to follow. | Low flexibility, hard to reuse. |
Best Practices
- Limit usage to specific single Actors or fixed structural relationships like parent-child.
- Make it a habit to always check if references are valid with
IsValidnode when obtaining references.
Blueprint Interface
Overview and Usage
Blueprint Interface is equivalent to C++ interfaces—a "contract" where "when you receive this message, the receiver decides how to process it."
Interfaces themselves have no processing. Any Actor that implements functions (messages) defined in the Interface can receive that message, regardless of class. This means the caller doesn't need to know the recipient's specific class (loose coupling).
Use Cases:
- When player presses "Interact" button, send an
Interactmessage to all interactable Actors in front of them—"Door," "Switch," "Treasure Chest," etc.
Blueprint Example (Interface Creation and Usage):
- Create Interface: Create an Interface called
BPI_Interactableand define anInteractfunction. - Implementation: Implement
BPI_Interactablein class settings for Door (BP_Door) and Treasure Chest (BP_Chest). - Write Processing:
Event Interactnode appears in each Actor's Event Graph—write respective processing (open door, open chest). - Call: Player side just calls
Message Interactnode on the Actor in front of them.
// BP_Player Event Graph
// TargetActor: Actor in front (Type: Actor)
Call TargetActor.Interact (Message)
Pros and Cons
| Pros | Cons |
|---|---|
| Achieves loose coupling, high extensibility and maintainability. | More implementation steps than Direct Reference. |
| Can send common messages to multiple different classes. | Processing is distributed between Interface and implementing classes, tracking is slightly complex. |
| High flexibility, easy to reuse. |
Best Practices
- Actively use for common functionality like "things that can ~" (e.g.,
BPI_Damageable,BPI_Usable). - Consider using Interfaces for generic communication from the early stages of your project.
Note: Interfaces Can Have Return Values
Blueprint Interface functions can define return values (Output). For example, you can design a
GetInteractionTextfunction inBPI_Interactablethat returns text to display during interaction. When there are return values, use regular function call nodes instead ofMessagenodes on the calling side.
Event Dispatcher
Overview and Usage
Event Dispatcher is a mechanism for notifying all Actors interested in a specific event when that event occurs. This is "one-to-many" communication (one source to multiple listeners), also called the "Observer Pattern" (or Publish-Subscribe pattern) in programming.
The caller just "fires" the event without needing to know who receives it. Recipients must "bind (register)" to the event beforehand.
Use Cases:
- When UI's "Start Game" button is pressed, notify multiple Actors—player, game mode, BGM manager.
- When enemy is defeated, notify multiple systems—score UI, drop item generation, achievement system.
Blueprint Example (Event Dispatcher Creation and Usage):
- Create Dispatcher: Create an Event Dispatcher called
OnGameOverin the event source Actor (e.g.,BP_GameMode). - Fire: Execute
Call OnGameOvernode when game over occurs. - Bind: In Actors that want to receive notifications (e.g.,
BP_ScoreUI), useBind Event to OnGameOvernode inBeginPlayetc. to register a Custom Event.
// BP_ScoreUI Event Graph (Binding)
Bind Event to OnGameOver (Event: Custom Event ScoreUpdate)
// BP_GameMode Event Graph (Firing)
Call OnGameOver
Pros and Cons
| Pros | Cons |
|---|---|
| Many-to-one notifications are very easy. | Bind and unbind management required. |
| Caller and recipients are completely independent (loosest coupling). | Processing flow can be hard to follow. |
| Suitable for global events like UI operations and game state changes. |
Best Practices
- When a bound Actor is no longer needed, always use
Unbind Eventnode to unregister (unbind) to prevent memory leaks. - Effective for game-wide events (game start/end, pause, score updates, etc.).
Choosing Among the Three Methods
When unsure which communication method to choose, refer to this flowchart and comparison table.
Communication Method Selection Flowchart
- Is the recipient a specific single Actor?
- Yes → Consider Direct Reference. However, if recipients might increase in the future, go with Interface.
- No → Continue.
- Are recipients "multiple different classes with common functionality"?
- Yes →Blueprint Interface. Loose coupling ensures extensibility.
- No → Continue.
- Do you want to notify "an unspecified number" about an event?
- Yes →Event Dispatcher. Ideal for UI and game state notifications.
Comparison Table
| Method | Coupling | Flexibility | Primary Use |
|---|---|---|---|
| Direct Reference | High (Tight Coupling) | Low | Specific single Actor, parent-child communication |
| Interface | Low (Loose Coupling) | High | Multiple different Actors with common functionality |
| Event Dispatcher | Lowest (Loose Coupling) | High | UI events, global game state notifications |
Common Mistakes
- Using Direct Reference for everything: Easy initially, but modification costs explode as the project grows. Use Interfaces for generic functionality.
- Forgetting to implement Interface messages: If you implement an Interface but forget to place the corresponding
Eventnode in the Event Graph, messages are ignored. - Forgetting to unbind Event Dispatchers: Not unbinding when Actors are destroyed causes events to continue being sent to non-existent Actors, leading to performance degradation and unexpected errors.
Guidelines for Choosing Communication Methods
Communication methods in Unreal Engine Blueprint are the design philosophy itself.
- Direct Reference is convenient individual conversation.
- Interface is business conversation based on common rules.
- Event Dispatcher is news broadcast to an unspecified audience.
By understanding these characteristics and using them appropriately, your Unreal Engine project will become more robust and extensible. Start by trying Interfaces and Event Dispatchers in small projects to experience their benefits.