Unreal Engine - Binding UPROPERTY of TArray<TObjectPtr<UButton>> from c++

30 Views Asked by At

I want to have the flexibility to choose how many buttons I need from the GUI designer and bind them to my c++ GUI logic. I have found out that a property of one button will bind if the button added in the GUI designer has the same name as the property. The reference will be cleared from the designer if I name it something else and hit compile(It has to be the same). My property looks like this:

UPROPERTY(EditDefaultsOnly, meta = (BindWidgetOptional))
TObjectPtr<UButton> OkayButton;

I am trying the same for adding multiple button properties like this:

UPROPERTY(EditDefaultsOnly, meta = (BindWidgetOptional, AllowPrivateAccess = "true"))
TArray<TObjectPtr<UButton>> actionButtons;

I have tried to name the button at index 0 actionButton(it will say the name already exists), actionButton0 and actionButton[0].

I don't understand the bind/reference logic when using TArray. Help!

0

There are 0 best solutions below