How to control a tick each loop before all other actors

I want to have a function or class, a time manager, that updates many difference variables of what’s going on in the world. I don’t want to have timers on every single actor, and the time manager can’t be an actor itself because nobody knows in what order actors are updated. It’s very simple, I just want get control with a tick before other actors are updated in the world. Thanks.

Have you tried setting a particular tick group on an actor to get it ticking ahead of the others? If your functionality is inside a non-actor, get this actor to update that object.


/** Determines which ticking group a tick function belongs to. */
UENUM(BlueprintType)
enum ETickingGroup
{
	/** Any item that needs to be executed before physics simulation starts. */
	TG_PrePhysics UMETA(DisplayName="Pre Physics"),

	/** Special tick group that starts physics simulation. */							
	TG_StartPhysics UMETA(Hidden, DisplayName="Start Physics"),

	/** Any item that can be run in parallel with our physics simulation work. */
	TG_DuringPhysics UMETA(DisplayName="During Physics"),

	/** Special tick group that ends physics simulation. */
	TG_EndPhysics UMETA(Hidden, DisplayName="End Physics"),

	/** Any item that needs rigid body and cloth simulation to be complete before being executed. */
	TG_PostPhysics UMETA(DisplayName="Post Physics"),

	/** Any item that needs the update work to be done before being ticked. */
	TG_PostUpdateWork UMETA(DisplayName="Post Update Work"),

	/** Catchall for anything demoted to the end. */
	TG_LastDemotable UMETA(Hidden, DisplayName = "Last Demotable"),

	/** Special tick group that is not actually a tick group. After every tick group this is repeatedly re-run until there are no more newly spawned items to run. */
	TG_NewlySpawned UMETA(Hidden, DisplayName="Newly Spawned"),

	TG_MAX,
};

Sorry about the double post, I thought the first one didn’t work, but it was just pending moderator approval.

I’ve read from somewhere that actors are by default set at the earliest tick group, which from memory was the Prephysics group, so it won’t be possible to create an earlier tick group, would it?

If I have something that’s a non-Actor, how would it be called at the start of every frame? Most things non-Actors don’t have a tick… I think.

Use the subclass of UGameEngine in the other post, override Tick function, manually update your thing in it, then call Super::Tick to call the base class version. That way, you’ve intercepted the Tick and did your own thing first.