One of the key advantages of UInterface in Unreal is the ability for users to implement UInterface
functions in the editor. This means the interface can be implemented strictly in Blueprint without needing any C++ code, which is helpful to designers.
Add the following function declaration to the header:
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = AttackAvoider) voidAttackIncoming(AActor* AttackActor);
Create a new Blueprint Class within the Editor:
Open Class Settings:
Click on the drop-down menu for Implement Interface, and select AttackAvoider:
Compile your blueprint:
Right-click in the Event Graph, and type
event attack
. Within the Context Sensitive menu, you should see Event Attack Incoming. Select it to place an event node in your graph:Drag out from the execution pin on the new node, and release. Type
print string
into the Context Sensitive...