.h:
#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "DllTask.generated.h"
UCLASS(Blueprintable, BlueprintType)
class TESTOR_API ADllTask : public APawn
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "Dll")
void HelloDll();
};
.cpp:
#include "DllTask.h"
void ADllTask::HelloDll()
{
if (GEngine) {
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Yellow, TEXT("HelloDll"));
}
}
效果如下:
小知识:
BlueprintType:将使用该宏标志的类公开为可用于蓝图中变量的类型(类似于:int)。 与之对应的有NotBlueprintType,即不可以在蓝图中创建该类型的变量。