UMyBPFunctionLibrary中的方法为静态方法
UMyBPFunctionLibrary.h
UCLASS()
class UMyBPFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_UCLASS_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "MyFunction|MyClass")
static void Method1();
UFUNCTION(BlueprintCallable, Category = "MyFunction|MyClass")
static void Method2();
UFUNCTION(BlueprintCallable, Category = "MyFunction|MyClass")
static void Method3();
};
UMyBPFunctionLibrary.cpp
UMyBPFunctionLibrary::UMyBPFunctionLibrary(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
}
void UMyBPFunctionLibrary::Method1()
{
}
void UMyBPFunctionLibrary::Method2()
{
}
void UMyBPFunctionLibrary::Method3()
{
}
这样蓝图中就可以调用c++中方法method1、method2、method3,方便蓝图与c++交互。