Sorry, the title isn’t totally what I want, but I’ll explain what I am trying to do. I am trying to store an array of structs containing a USceneComponent derived class reference and a float. I want to access that array in C++, but define it in blueprint. The USceneComponents are already attached to my blueprinted object, and I want to store references to them in the array along with their float data, but ideally I want to do this in Properties as default values.
I’d like to avoid setting each index in my construction script because it’s a little harder to understand for others, and having it
My basic struct looks like:
USTRUCT()
struct MyStruct
{
public:
GENERATED_USTRUCT_BODY()
UPROPERTY(Category = Sprite, EditAnywhere, meta = (DefaultValue = "1", ClampMin = "0.0", UIMin = "0.0", ClampMax = "1.0", UIMax = "1.0"))
float myFloat;
UPROPERTY(Category = Sprite, EditAnywhere, BlueprintReadWrite, Instanced)
USceneComponent* myComponent;
FChargeInteractorDefinition()
: myComponent(nullptr)
, myFloat(0.0f)
{
}
};
My array definition looks like:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Properties)
TArray<MyStruct> myArray;
My scene component fields never show up in my array properties.
The alternative is to make a subclass of my USceneComponent derived class that also stores the float, which isn’t the end of the world, but will require me to remake my existing components with the new derived types I think.