Changing Actor Tick Interval while running

My solution…

In my utilitiues .h file

UFUNCTION(BlueprintCallable, Category = TDLHelpers)
	static void TDLChangeTickInterval(AActor * actor, float newInterval);

And in my .cpp file

void UtdlBlueprintHelpers::TDLChangeTickInterval(AActor * actor, float newInterval)
{
	if (IsValid(actor))
	{
		actor->PrimaryActorTick.TickInterval = newInterval;
	}
}

All tested and works great.

Then in my NPC actor blueprint on the tick I check the distance to the nearest Player and calculate the interval for the next tick.
We use (so far) 1 second per 5 meters linear, clamped to 0.25 to 10 second range.

1 Like