Tarray showing blank details panel in blueprint

I’m trying to create a Tarray our of UPaperSpriteComponent components. but when i create a blueprint, the component detail panel is blank, am i doing something wrong ?

.h

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = collision, meta = (AllowPrivateAccess = "true"))
    		TArray<UPaperSpriteComponent*> Barsx;

.cpp

	Barsx.SetNumUninitialized(2);
	Barsx[0] = CreateDefaultSubobject<UPaperSpriteComponent>(TEXT("Lite1"));
	Barsx[0]->AttachTo(Body);

	Barsx[1] = CreateDefaultSubobject<UPaperSpriteComponent>(TEXT("Lite2"));
	Barsx[1]->AttachTo(Body);

Hey spazchicken-

I was able to reproduce the blank details panel and have entered a bug report (UE-28067) for investigation. For your issue of having an array of components, the best solution would be to declare each component individually as well as have the array available. After the CreateDefaultSubobject line for each component, you can then add the newly created component to the array:

.h

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
UBoxComponent* Box1;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
UBoxComponent* Box2;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
UBoxComponent* Box3;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
TArray<UBoxComponent*> Boxes;

.cpp

Box1 = CreateDefaultSubobject<UBoxComponent>(TEXT("Box1"));
Box2 = CreateDefaultSubobject<UBoxComponent>(TEXT("Box2"));
Box3 = CreateDefaultSubobject<UBoxComponent>(TEXT("Box3"));

Boxes.Add(Box1);
Boxes.Add(Box2);
Boxes.Add(Box3);

This should enable you to edit each component inside the blueprint while still having access to each component through the array.

Cheers

Doug Wilson

oh that works perfectly thank you! Hate to ask , but is it possible to create a 2D Tarray or are they 1D only? :slight_smile:

You could have a TArray of TArrays, however creating a single two dimensional TArray is more complicated and generally avoided.

ok np, thanks for your time!

I’m having a related issue where when using a TArray of components, even with a UPROPERTY and EditAnywhere, I can’t modify the components while the game is running. I also can’t find UE-28067 in the tracker when searching. What happened to this ticket?

Hey Rael5-

UE-28067 is now publicly visible here: Unreal Engine Issues and Bug Tracker (UE-28067)

For your specific issue, can you explain exactly what you’re attempting to modify during runtime? Are you referring to changing values in the details panel or changing values through code? Please provide as much information relating to your specific case as possible.

Yea, i’m referring to changing values in the details panel. Here’s screenshots to show what I mean:

106213-array1.png

106214-array2.png

So, even though it’s set as EditAnywhere, I can’t change anything in the details panel. Even the RootComponent, which is the first element in the TubeMeshes array, isn’t editable.

Yea that solution does work, but I’m adding in components dynamically so I can’t create them separately anyway. I was just wondering about the status of the ticket. It’s not something important, but just an annoyance and something that can make work a little harder sometimes.

How are you adding the components to the array? Using the solution mentioned in my answer of creating the components and then adding the components to the array, I am still able to edit the details panel of the actor / components while the game is running.