Pre-ticking an Actor

I have a manager class that I would like to have tick (from c++) before all the other actors in the scene. It handles things like time of day updating, AI perception batching, PCG stepping and more.

In my ideal world there would be a “pretick” function on all Actors that would be guaranteed to be called before ANY tick() function.

In the absence of that, I can see that this could be mostly accomplished through the AActor::SetTickPrerequisite method, though this is really clumsy, since the pre-ticked manager class would need to be set as a prereq for basically every thing in the world.

Right now I’m considering jumping into the bowels of the engine and defining a new tickgroup, TG_PreTick, and adding this manager class to that group. Is that a bad idea? Are there unforeseen complications that will cause me trouble down the line? Are there any other sanctioned methods for getting this working?

Thank you!

UPDATE: Creating a new tick group did not blow up the world (yet), so that’s what I’m going with until I hear otherwise.

Why don’t you try setting tick groups the way you want and make manager to tick before objects the manage? did you actully tried using eariest tick group?

All Actors by default fall into the “PrePhysics” tick group, which IS the first one. So what I’m proposing is adding a new group before PrePhysics.

Thanks, I should have specified that I had looked into that approach.

I’m curious as to why this was never implemented into the engine? Is there some way of achieving a pre-tick before all other Actors already? I’ve tried searching through the source and ran into the FTickTaskManager singleton, but found no way to override with my own. Any solutions to this without having to add a tick prerequisite for every Actor?

We’ve been running with the new TG_PreTick tick group for the past couple months, without any problems. Implementing it did require some targeted engine changes, but nothing too intense. If you are build source, I’m sure you could get it implemented in a couple hours.

I’m sure it would also be easy for Epic to incorporate into the next update, if they’re listening!

in case people from epic are reading this, our group would also find a lot of use for this!

Agreed. To add each actors as prerequisites is just tedious and error-prone, there should be something like an integer representing the final priority so it’s more visualized and easy-to-change.

thats what Tick Group is but it’s enum based and even with integers you would have problem to fit your actors in to rest of engine actor classes

This feature is a must . We need a TG_PreTick group at least. Being able to prioritize within a group would be nice but at least let us be certain that something will tick before everything else, even if it’s just usable in a custom FTickFunction.