Download

[4.17] TArray didn't support UStruct ?

Hi

I update the engine version from 4.16 to 4.17 and during the conversion of my project , I got this new build error


2>  Running UnrealHeaderTool "D:\UnrealProject\RPGProject\RPGProject.uproject" "D:\UnrealProject\RPGProject\Intermediate\Build\Win64\RPGProjectEditor\Development\RPGProjectEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
2>D:/UnrealProject/RPGProject/Source/RPGProject/Item.h(40) : LogCompile: Error: Type 'TArray<FItemData>' is not supported by blueprint. Item.itemArray

Here is the code from one error



USTRUCT()
struct FItemData
{
    GENERATED_USTRUCT_BODY();

    FString name;
    int32 id;
    int32 bonus;
    int32 quantity;
    bool singleTarget;
    bool offensive;
};

UCLASS()
class RPGPROJECT_API AItem : public AActor
{
    GENERATED_BODY()

public:    
    // Sets default values for this actor's properties
    AItem();

protected:
    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

public:    
    // Called every frame
    virtual void Tick(float DeltaTime) override;

    UPROPERTY(EditAnywhere, BlueprintReadWrite)
    TArray<FItemData> itemArray;
};



Because my project use a lot of TArray<> , the project can’t be convert…

Can someone help me

Thanks a lot !

PS : I don’t know if this question should be on engine or gameplay. Move to the right section if I post on the wrong section

Try using
GENERATED_BODY() on structs, I think that is the new rule.

I think you need to have USTRUCT(BlueprintType) now.

Thanks a lot !

I try that right now

As of 4.17, UHT now requires structs to be BlueprintType in order for them to be used a BlueprintReadWrite/ReadOnly properties. This was always the idea, it just wasn’t enforced until now.

Is the code exactly as you posted it? Your struct is gaining nothing from being a USTRUCT, nor is there any point to your use of EditAnywhere/BlueprintReadWrite on your array property, since no properties of your struct are reflected. You shouldn’t make the struct BlueprintType just to get it to compile, you should remove the reflection elements that you’re not actually using.

That works

Thanks !

EDIT : Kamrann : Thanks for the advice . I will change this structure

I have the same error when switch my project to 4.17. This helps me a lot, thank you!