Creating C++ UInterface function implementations that can be overridden in Blueprint

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.

How to do it...

  1. Create a new interface called Wearable (IWearable, UWearable).
  2. Add the following functions to the header:
    UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = Wearable) int32GetStrengthRequirement(); UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = Wearable) boolCanEquip(APawn* ...

Get Unreal Engine 4 Scripting with C++ Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.