Download

Confused on why my struct can't be edited in Blueprint

I have this really simple code:



#pragma once

#include "AItem.h"
#include "ACompoundItem.generated.h"

USTRUCT(BlueprintType)
struct FCompoundItemComponent
{
	GENERATED_USTRUCT_BODY()
	AAItem* item;
	float contribution;
};

/**
 * 
 */
UCLASS()
class SETI_PROTOTYPE_1_API AACompoundItem : public AAItem
{
	GENERATED_BODY()
	
public:
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Composition")
	TArray<FCompoundItemComponent> components;
	
	
};


Inside of Blueprint I can add elements to the components array, but the individual elements of that array, which are of the FCompoundItemComponent struct can’t be edited. The individual struct is just empty in BP. If in BP I try to use a “Make CompoundItemComponent” similar to how you would do “Make Vector”, then it doesn’t have any actual inputs.

I’m sure I have just done something wrong to properly wire this up and expose it to Blueprint, I am just not sure what.

Screenshot 2015-07-19 20.04.34.png
de28873fa83e33f4d98a5a91e3bb97061cdb2278.png

hello,

you should use UPROPERTY´s inside your struct as well.




UPROPERTY(EditAnywhere)
AAItem* item;

UPROPERTY(BlueprintReadWrite)
float contribution;



just an example but this should solve your problem :wink:

best regards
Wallhalla

Ahh thank you! Obvious in hindsight.