UI to access protected variables

Hey guys, I’ll explain the whole situation. I have an ACharacter class and I factored it in an AActorComponent and called it CharacterComponent. They’re all looking good and I do a bunch of private/protected things in CharacterComponent. Now I want to acess a protected UStruct inside my character component using UI Buttons. I created a class inherited from CharacterComponent(so this way I can access the protected variable), called CharacterComponentUI, but it doesn’t work at all:
CharacterComponentUI.h file:

class MEHILOONLINE_API UCharacterComponentUI : public UCharacterComponent
	bool Initialize();

	UPROPERTY(meta = (BindWidget))
	class UButton* STRButton;

	void STRPressed();


bool UCharacterComponentUI::Initialize()
	bool Success = Super::Initialize();
	if (!Success) return false;

	if (!ensure(STRButton != nullptr)) return false;
	STRButton->OnClicked.AddDynamic(this, &UCharacterComponentUI::STRPressed);

	return true;

void UCharacterComponentUI::STRPressed()
	UE_LOG(LogTemp, Warning, TEXT("PRESSED STR"));

I just did what i’m used to do with UI stuff, but unlike a UUserWidget, the class “AActorComponent” doesn’t have a Initialize().

What’s the correct approach to solve my problem?

Hi LeoRocha,

What exactly are you trying to access? STRButton from a UMG Blueprint?

Hi LeoRocha,

We haven’t heard from you in a couple of days, so I’m going to mark this question as closed for tracking purposes. If you would like to re-open it, feel free to leave a comment.