UENUM
命名空间MyEumType,可枚举type1,type2,type3等等
BlueprintType的作用是可以在蓝图创建变量的时候也可以作为选项
UENUM(BlueprintType)
namespace MyEnumType
{
enum MyCustomEnum
{
Type1,
Type2,
Type3,
};
UENUM(BlueprintType)的作用就是可以在这里找到
然后在C++里面声明变量
<MyEnumTyp::MyCustomEnum>
(命名空间的名字):(自己创建的名称)
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MyEnum")
TEnumAsByte<MyEnumType::MyCustomEnum>MyCustomEnum;
在类的默认值里可以发现
在视口中创建
UStruct
这里定义了两个变量,health和MyName
BlueprintType的作用是可以在蓝图创建变量的时候也可以作为选项
USTRUCT(BlueprintType)
struct FMyTestStruct
{
GENERATED_USTRUCT_BODY()
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MyTestStruct")
int32 Health;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MyTestStruct")
FString MyName;
};
USTRUCT(BlueprintType)的作用
声明结构体变量
//UStruct
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "MyCustomStruct")
FMyTestStruct MyCustomStruct;
在类默认值中显示
在视口中创建
笔记总结来源于:【【虚幻5】UE5C++零基础全网全流程开发从入门到进阶教程合集(持续跟新中)】https://www.bilibili.com/video/BV1Dc411f7nx?vd_source=90cb1ac44856e5e826e2bee8aa9d8a41