Changing Actor Tick Interval while running

About the new 4.9 Actor Tick Options.

How can i change the Tick interval in Blueprints while the game is running.

Under Utilities I can only enable or disable an actors tick. Is there a way to change the Tick Interval while running ?

You could always add a condition after the tick that says something like;

When running, only perform the rest of the blueprint after 10 ticks. This will have the same effect as increasing the tick interval.

You could do this by incrementing a number every tick, then when this number equals 10, perform your blueprint actions then set the number back to zero.

You can’t as that property i only for EditDefaultsOnly and don’t have any blueprint interactions on and there seems to be no functions associate with it

Normally this means variable change does not have any effect in real time and it’s only relevent during initiation… but if i read source right this is not the case here, but i’m might be wrong. But if it works during gameplay then for now it’s only via C++, you can easily make node for your own.

Thanks you for answering.
Guess i am going to wait a bit until it will be implemented

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

out of curiosity, why not use a timer?

I have found this does work, with some limitations - namely the interval only takes effect after the next tick. For example, if you have your tick interval set to 5 seconds, and 1 second into the tick you set the interval to 0 (to tick every frame), you still will wait 4 seconds for the next tick, and then after that the ticks will occur every frame.

This isn’t so much a problem when you are setting the tick interval higher, but obviously this causes problems when you are trying to shorten the interval.

To fix this issue, you can disable ticking, set the shorter interval, then re-enable ticks (I’m in C++ here.) For an occasional tick change this isn’t a problem. However, if you are trying to vary the tick interval continuously you can run into some issues with this approach.