C++ implementation of a Function Library?

I want to create a blueprint function library but have most of the functions be implemented in C++. How do I do this?

I’ve tried to create my own class which inherits from “BlueprintFunctionLibrary.h” and implemented a few methods and then create my own blueprint function library which inherits from this class, but when I try to create the blueprint, it can’t seem to find the derived class I created. If I create an empty function library and try to reparent it to my own class, there isn’t actually an option within the editor to reparent a function library.

Have you marked your UFUNCTIONS BlueprintCallable and most importantly, static? Here’s an example of my Blueprint function library header:




UCLASS()
class ALMYRA_API USkillUtil : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
	
public:
	/** Fills Destination array with tiles in a diamond shape. */
	UFUNCTION(BlueprintCallable, Category=Almyra)
	static void GenerateDiamondShape(const FVector2i Center, const int32 MinRange, const int32 MaxRange, TArray<FVector2i>& Destination);
}


You don’t need to create a blueprint of this class, the methods will just show up in the global function space.

4 Likes

Ah, that is exactly what I needed! Thank you!

I was missing the “static” keyword and thought that I needed to create a blueprint which inherits from it to get access to the functions… Thank you!