How to override Tick event?
I somehow made a class derived from UUserWidget to make a custom UMG Widget Blueprint. Next step is I need to put some custom C++ code on every tick as UMG widget shows up on the screen. Please show me how to do . So far 's what I’ve done :
At .h file :
class TESTUMGINVENTORY_API UMyInventoryUserWidget : public UUserWidget
{
GENERATED_UCLASS_BODY()
virtual void Tick(FGeometry MyGeometry, float DeltaTime) override; // i want to override tick
};
At .cpp file :
UMyInventoryUserWidget::UMyInventoryUserWidget(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
}
void UMyInventoryUserWidget::Tick(FGeometry MyGeometry, float InDeltaTime)
{
UUserWidget::Tick(MyGeometry, InDeltaTime);
print("Ticking brohh!"); // using #define print->gEngine
}
And then i make new widget blueprint based on custom UUserWidget class. I’ve made sure that the widget is perfectly initialized (created & added to viewport). Problem is the “Ticking broh” text never shows up. As if the Tick() function never gets called.
Is the correct way to do it? Please help.
Thanks.