Hey guys,
I’m trying to do something really simple, I have a struct with some component that I create in my constructor and attach it to the root. No problem so far, everything is created and moved in the origin of my Root. But When I go into my blueprint to move those component manually, I can’t access them.
USTRUCT(BlueprintType)
struct XROAD_API FXRoadVehicleSeat
{
GENERATED_USTRUCT_BODY()
public:
FXRoadVehicleSeat() {}
FXRoadVehicleSeat(UBoxComponent* LocalDoorInteractionCollision,
UArrowComponent* LocalExitVehicleArrow,
EDoorPosition LocalDoorPosition,
FName LocalSocketName,
AXRoadPedestrian * LocalPedestrianOnTheSeat = NULL,
bool bLocalIsDriverSeat = false)
{
DoorInteractionCollision = LocalDoorInteractionCollision;
ExitVehicleArrow = LocalExitVehicleArrow;
DoorPosition = LocalDoorPosition;
SocketName = LocalSocketName;
PedestrianOnTheSeat = LocalPedestrianOnTheSeat;
bIsDriverSeat = bLocalIsDriverSeat;
}
public:
UPROPERTY(BlueprintReadWrite, VisibleAnywhere, meta = (AllowPrivateAccess = "true"), Category = "XROAD|Vehicle|Seats")
UBoxComponent * DoorInteractionCollision;
UPROPERTY(BlueprintReadWrite, VisibleAnywhere, meta = (AllowPrivateAccess = "true"), Category = "XROAD|Vehicle|Seats")
UArrowComponent * ExitVehicleArrow;
UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"), Category = "XROAD|Vehicle|Seats")
EDoorPosition DoorPosition;
UPROPERTY(EditAnywhere, meta = (AllowPrivateAccess = "true"), Category = "XROAD|Vehicle|Seats")
FName SocketName;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "XROAD|Vehicle|Doors")
AXRoadPedestrian * PedestrianOnTheSeat;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "XROAD|Vehicle|Seats")
bool bIsDriverSeat;
};
This is my stucture containing my two component I want to modify.
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "XROAD|Vehicle|Interaction")
TArray<FXRoadVehicleSeat> VehicleSeats;
Here is my declaration of FXRoadVehicleSeat which is my structure containing my components.
NumberOfSeats = 4;
for (int i = 0; i < NumberOfSeats; ++i)
{
// Door Collision
UBoxComponent * Collision = CreateDefaultSubobject<UBoxComponent>(FName(*FString(GETENUMSTRING("EDoorPosition", (EDoorPosition)i) + "_Collision")));
Collision->SetupAttachment(RootComponent);
// Exit Arrow for the pedestrian
UArrowComponent * ExitVehicleArrow = CreateDefaultSubobject<UArrowComponent>(*FString("ExitArrow_" + FString::FromInt(i)));
ExitVehicleArrow->SetupAttachment(Collision);
VehicleSeats.Add(FXRoadVehicleSeat(Collision,
ExitVehicleArrow,
(EDoorPosition)i,
FName(*(GETENUMSTRING("EDoorPosition", (EDoorPosition)i))),
NULL));
}
And finally my constructor where I initialize every Component.
Here is the result of this code. I still can’t access them, but if I’m putting them outside a struct It’s working as intended, I can modify them manually. I think I am missing something or it’s just not possible, I put VisibleAnywhere or EditAnywhere for my component and even BlueprintReadWrite but I still can’t have any control over them in my Viewport or details panel.
Any feedback is welcome! Thanks!