Say you need a dumb data container for usage in either Blueprints or C++.
Does your container need functions? Use a UCLASS UOBJECT, otherwise, use USTRUCT.
UCLASS:
- From the editor, create a new C++ class, Show All, choose UObject
- Set the following specificers for UCLASS and UPROPERTY in the header file:
UCLASS(BlueprintType) class x_API UMyObject: public UObject { GENERATED_BODY() public: UPROPERTY(EditAnywhere, BlueprintReadWrite) MyProperty* Property; UFUNCTION(BlueprintCallable) void MyFunction();
USTRUCT:
- Create an Empty C++ class from the editor
- Edit the header file:
USTRUCT(BlueprintType) struct FMyStruct { GENERATED_STRUCT_BODY() UPROPERTY(EditAnywhere, BlueprintReadWrite) MyProperty* Property;