Use FTickFunctions or override Tick

Hi,

in my current project I started using FTickFunctions over just adding stuff to Tick() for more complex calculations. But I’m still not sure whether that’s the best idea. Is there any downside performance- or otherwise to it? I can mostly think of upsides like no need to worry about engine updates that change the normal Tick() and keeping the Tick() small and clean. It is a little more complex, though, because I need to register the function in RegisterComponentTickFunctions().

Is there anything I have to keep in mind when using FTickFunctions? Should I avoid them or use them more often?

Thanks

How did you added another Tick function to component ? I tried to do it, but it constantly crashes ;/.

Hm, the only difference I see at the moment is that I check the TickType before I do anything with Target in ExecuteTick… So maybe Target isn’t valid yet or something:

void FQuadCharacterMovementComponentAutoJumpObstaclesTickFunction::ExecuteTick(float DeltaTime, enum ELevelTick TickType, ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent)
{
	if ((TickType == LEVELTICK_All) && Target && !Target->IsPendingKillOrUnreachable())
	{
		FScopeCycleCounterUObject ComponentScope(Target);
		FScopeCycleCounterUObject AdditionalScope(Target->AdditionalStatObject());
		Target->AutoJumpObstaclesTick(DeltaTime, *this);
	}
}

EDIT: oh, and my ReigsterComponentTickFunctions is different:

if (bRegister)
		{
			if (SetupActorComponentTickFunction(&AutoJumpObstaclesTickFunction))
			{
				AutoJumpObstaclesTickFunction.Target = this;
			}
		}
		else
		{
			if (AutoJumpObstaclesTickFunction.IsTickFunctionRegistered())
			{
				AutoJumpObstaclesTickFunction.UnRegisterTickFunction();
			}
		}