Hi. I’m trying to make a custom struct, and have an array of them as a field in a Blueprint class.
Struct:
USTRUCT(BlueprintType)
struct FKCVRMenuButtonSettings
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VRMenu|Button Settings")
float DepressSpeed = 50.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VRMenu|Button Settings")
float DepressDistance = 1.0f;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "VRMenu|Button Settings")
bool UseProgressBar;
};
I added a fields to my “Menu” class:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = KCVRMenuDeviceControl)
TArray<FKCVRMenuButtonSettings> ButtonSettings;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = KCVRMenuDeviceControl)
FKCVRMenuButtonSettings SingleButtonSettings;
And I added C++ UChildActorComponent in “Device” class for “Menu”:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Controllers")
UChildActorComponent* VRMenuComponent;
.cpp
VRMenuComponent = CreateDefaultSubobject<UChildActorComponent>(TEXT("VRMenuComponent"));
VRMenuComponent->SetupAttachment(RootComponent);
Then, in the Blueprint, I assigned this component a BP_Menu with these fields. However, I cannot edit these struct fields.
BUT if I add a ChildActorComponent directly Blueprint and assign the same BP_Menu to it, then the fields are edited. I can’t figure out what is the difference between adding ChildActor in Blueprint and C++ and what am I missing?