Problem with UI button to change protected stuff.

Hey guys, I’ll explain the whole situation. I factored my ACharacter class into an AActorComponent(where I do a lot of private/protected things) and called it CharacterComponent. Now I want to change some values of a protected UStruct inside my CharacterComponent, but using a Button. The whole part of creating the Widget Blueprint is okay, but I can’t create a UUserWidget class to handle these buttons callbacks because I need to change the protected values, so I tried to do something like this:
I created a class inherited from my CharacterComponent class and wrote this code:


#include "CharacterComponentUI.h"
#include "MenuSystem/MenuWidget.h"
#include "Blueprint/UserWidget.h"
#include "MenuInterface.h"
#include "MenuWidget.h"
#include "Components/Button.h"

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

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

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

And CharacterComponentUI.h:

#include "CoreMinimal.h"
#include "CharacterComponent.h"
#include "MenuSystem/MenuWidget.h"
#include "Blueprint/UserWidget.h"
#include "MenuInterface.h"
#include "MenuWidget.h"
#include "CharacterComponentUI.generated.h"

class MEHILOONLINE_API UCharacterComponentUI : public UCharacterComponent

    bool Initialize();

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

    void STRPressed();

But reading this you’ll probably notice that class “UActorComponent” has no member Initialize(). I really just copied the way I did with previous Menu/button stuff. What’s the correct approach to solve my problem? Am I in the correct path?

Note: I know that I’m not using all these includes, I’ll remove the ones I’m not using later.