How do you tick one class before another before physics?

TL/DR at the end.

Hi! I’m creating a Tower Defense and noticed that my movement prediction is slightly off.

It seems like my towers tick before my enemies.
The towers have to tick pre-physics (retargeting/rotating etc.).

Sadly I can’t find a way to add a new tick group.
I tried googling but all I can find is an infinite amount of beginner tutorials explaining what “ticking” is.

TL/DR either is fine:

  • Is there a way to add a new tick group?
  • Is there a way to have all my towers ticking after all my enemies but still before physics?

All my enemies are inheriting from a single enemy class.
All my towers are inheriting from a single tower class.

Hey @TheOriginalArkless,

I am unaware of a way to add new tick group. Are your enemies also in the pre-physics tick group? You can use an Add Tick Prerequisite Actor node in the tower class construction script along with a Get All Actors of Class node to get a reference to your enemy class, this will allow you to set a tick order hierarchy to members of the same tick group.

My understanding of ordering ticks this way is that this only defines order within the same tick group; while you may be able to nominally assign an actor to Pre-Physics then set it to wait until a Post Physics actor ticks, you are no longer in the Pre-Physics part of the frame by the time the tick actually occurs.

Note that this only applies to the actor itself, if the tower has components that need to tick early those need to be set as well.

I hope this information helps, and good luck!

Thank you for your input.

I found that method but I think it’s not efficient enough.
That would mean I have to query all towers whenever I spawn an enemy and query all enemies whenever I spawn a tower.
One of my plans for the future is to have interactive projectiles as well. This would lead to a lot of dependencies and queries.

My workaround is not using the inbuilt tick and instead calling my own tick groups from the level blueprint. I was hoping for a better solution than recreating an already existing feature :frowning:

I’m going to mark my previous post as solution since it IS working. This does not make me happy though :frowning: