- Create some UObject-derivative class, specifying both Blueprintable and BlueprintType, such as in the following code, using the same class we created previously:
/** * UCLASS macro options sets this C++ class to be * Blueprintable within the UE4 Editor */UCLASS(Blueprintable, BlueprintType)class CHAPTER_02_API UUserProfile : public UObject{ GENERATED_BODY()public: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Stats) float Armor; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Stats) float HpMax; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Stats) FString Name;};
The BlueprintType declaration in the UCLASS macro is required to use the UCLASS as a type within a blueprints diagram.
- Save and compile ...