Recommendation
Use a direct call when the receiver is known. Cast only to check a known reference's concrete type. Use an Interface when different types share one request. Use an Event Dispatcher when one sender announces to listeners.
Compare the options
Direct Reference
Choose when
- The caller knows the exact receiver.
- The relationship is one-to-one.
- The caller needs direct access to the receiver API.
Tradeoffs
- The caller depends on the receiver type.
- The caller must obtain and retain a valid reference.
- Blueprint
- Use a typed object variable, then call a function or read a property.
- C++
- Use a typed pointer or reference and call the method directly.
Cast
Choose when
- A reference already exists.
- The caller needs to check its concrete type before using type-specific API.
Tradeoffs
- Casting does not find objects.
- Repeated concrete casts couple the caller to implementation classes.
- Blueprint
- Use Cast To <Class> on an existing object reference.
- C++
- Use Cast<T>() or CastChecked<T>() when failure is impossible by contract.
Interface
Choose when
- Unrelated receiver types implement the same request differently.
- The caller only needs the shared contract.
Tradeoffs
- The caller still needs a receiver reference.
- An Interface defines functions but does not store shared state.
- Blueprint
- Create a Blueprint Interface and call its Interface Message on the receiver.
- C++
- Use UINTERFACE, an IInterface type, and generated Execute_<Function> calls for reflected interfaces.
Event Dispatcher
Choose when
- One sender announces an event to any number of listeners.
- The sender must not depend on listener types.
Tradeoffs
- Listeners must bind and unbind at valid lifecycle points.
- Listener execution order is not a reliable contract.
- Blueprint
- Create an Event Dispatcher and use Bind, Assign, Unbind, and Call.
- C++
- Use a multicast delegate. Use DECLARE_DYNAMIC_MULTICAST_DELEGATE when Blueprint exposure is needed.
Requirements
All communication methods are built into CoreUObject, Engine, and Blueprint.
Example
Call Interact through an Interface so doors, terminals, and pickups respond differently. Broadcast OnHealthChanged so UI, audio, and gameplay listeners can react.