Overriding UUserWidget::NativeTick()

Extending from UUserWidget, how can I override NativeTick? This does not seem to have any effect:

.h

virtual void NativeTick(const FGeometry & MyGeometry, float InDeltaTime) override;

.cpp

void URoMWidget::NativeTick(const FGeometry & MyGeometry, float InDeltaTime)
{
	Super::NativeTick(MyGeometry, InDeltaTime);

	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("URoMWidget::NativeTick()"));
}

It looks right, make sure that the widget is added and can be seen in the viewport.

Did you ever solve this?

you need public the Native tick to make it work.

public:
void URoMWidget::NativeTick(const FGeometry & MyGeometry, float InDeltaTime)
{
1 Like

its been like 9 yrs and this post still isnt solved lol

The tick of the uuserwidget is automatic. If the uuserwidget does not have an event that requires a tick, the tick will not be enabled. You can add a button to try it

I think I need to modify my answer, I forgot to write Super::NativeConstruct(); which could also cause this phenomenon.