UMG bCanEverTick not work.

I was set value UUserWidget::bCanEverTick = false;
But UUserWidget::NativeTick() was called.
I want to not called Tick funcion.
How to do it?

My experience is that if you change the bCanEverTick value at runtime (beyond construction), it goes unheeded. I don’t think it’s intended for use as an on/off switch - more an optimisation if an object doesn’t require DT updates ever.

This is (kind of) suggested in UserWidget.h:

/** If a widget doesn't ever need to tick the blueprint, setting this to false is an optimization. */
bool bCanEverTick : 1;

Now in FTickFunction, there’s SetTickFunctionEnable(bool) which does what you’re asking for: a runtime state flag which controls whether tick is called. On Actors, it’s SetActorTickEnabled(bool) which performs this on the member tick function instance. However, UUserWidget derives from UWidgetUVisualUObject. None of these classes expose any similar implementation.

So whilst it’s probably not the answer you’re hoping for, the answer is to put your own conditional control statement in your widget’s native tick function that performs an “early out” if a flag is lowered:

void NativeTick(const FGeometry& MyGeometry, float InDeltaTime)
{
   if (!bTickEnabled) return;
  
   // Perform tick stuff
   .
   .
   .
}