Global Blueprint-Callable C++ Functions?

This is what you want: Blueprint Function Libraries | Unreal Engine Documentation

Create a class derived from UBlueprintFunctionLibrary and create a static function like this:

UFUNCTION(BlueprintCallable, Category = "CustomDamage")
static void ApplyDamage(UDamageType* Type, float Damage, AActor* Receiver);

This function will now be globally visible for all blueprints. Note that for some functions you may need a UWorld object e.g. for spawning or game state information. While you could pass in a valid UObject all the time it can be more comfortable to just use the calling object as a world context object. This way you can drop the Context Object pin.

UFUNCTION(BlueprintCallable, Category = "Category", meta = (HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject"))
		static void DoSomething(UObject* WorldContextObject);

The node of this function won’t show the WorldContextObject as a pin but will always default to the calling object as WorldContextObject. Just fyi

1 Like