BlueprintCallable
BlueprintCallable
可以在蓝图中调用 可定义为静态
class CPPDIGITALTWN_API UEUtil : public UBlueprintFunctionLibrary
{
GENERATED_UCLASS_BODY()
public:
UFUNCTION(BlueprintCallable)
static FString GetTime();
}
BlueprintImplementableEvent
BlueprintImplementableEvent
此函数只能蓝图或关卡蓝图图表中被覆盖。 (事件中选择重写)
UFUNCTION(BlueprintImplementableEvent, Category = "ChangeWeather")
void switchWeather(int flag);
swithWeather
不能在cpp中实现
BlueprintNativeEvent
BlueprintNativeEvent
可在蓝图中实现也可以同时 本地实现。c++这边的实现应该定义为函数名_Implementation
//.h file
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "Components/Image.h"
#include "MainUIParent.generated.h"
UCLASS()
class CPPDIGITALTWN_API UMainUIParent : public UUserWidget
{
GENERATED_BODY()
UFUNCTION(BlueprintNativeEvent, Category = "Basic")
void switchMode();
virtual void switchMode_Implementation();
}
//cpp
void UMainUIParent::switchMode_Implementation()
{
UKismetSystemLibrary::PrintString(this, TEXT("切换模式被点击了"));
}
BlueprintPure
BlueprintPure
纯函数
在蓝图中没有引脚 必须有返回值
摘自网络上的描述:
BlueprintPure的特点是在C++和蓝图中都可以调用,但是其修饰的函数必须有函数返回值或
函数参数输出,否则会编译失败。被声明的函数不会以任何方式拥有对象,并且可以在蓝图
或级别蓝图图标中执行。
因此,BlueprintPurs修饰的函数,主要用于(1)数学中的“+、-、*、/”操作 (数值处理)
网友评论