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.
UInterface
called AttackAvoider
.UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = AttackAvoider) voidAttackIncoming(AActor* AttackActor);
event attack
. Within the Context Sensitive menu, you should see Event Attack Incoming. Select it to place an event node in your graph:print string
into the Context Sensitive menu to add a Print String node.UInterface
function within Blueprint.UINTERFACE
/IInterface
are created in exactly the same way that we see in other recipes in this chapter.UFUNCTION
specifier: BlueprintImplementableEvent
.BlueprintImplementableEvent
tells the Unreal Header Tool to generate code that creates an empty stub function that can be implemented by Blueprint. We do not need to provide a default C++ implementation for the function.UInterface
function to our Blueprint implementation.18.119.248.159