Just as with the previous recipe, UInterfaces are useful, but that utility is severely limited without their functionality being usable by designers.
The previous recipe shows you how to call C++ UInterface
functions from Blueprint; this recipe will show you how to replace the implementation of a UInterface
function with your own custom Blueprint-only function.
Create a new interface called
Wearable
(IWearable
,UWearable
).Add the following functions to the header:
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = Wearable) int32GetStrengthRequirement(); UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = Wearable) boolCanEquip(APawn* Wearer); UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = Wearable) voidOnEquip(APawn* Wearer);
Add the following function implementations in the implementation file:
int32 IWearable::GetStrengthRequirement_Implementation() { return...