IsAllowedToTick

surely this must be called on tick so how does this differ from an IF statement inside the tick override function?

If your object is registered to check for tick, this is part of the checklist.

  • IsAllowedToTick is kind of an object general state.
  • then IsTickable says if we can tick on this current call or not. (having ETickableTickType::Always set will/may bypass this)
  • then if all true your tick can run.

More organized for sure.
Also saves you the Tick overhead with the if.
While this may be neglible, doing it with thousands of objects may add up.
Also is possible this avoids sending the ticks to worker threads leaving room for others, but I’m not sure, and did not test this.

thats what im curious about, if its actually more efficient? but unless IsAllowedToTick is event driven surely it has to check every tick IF IsAllowedToTick.

for context i make sure my object is initialized before ticking so i could put the bIsInit in IsAllowedToTick(return bIsInit) or as an IF statement in the tick override but seems the same to me

Yeah it has to check in an if, and still I would put that into IsAllowedToTick.

Putting into IsAllowedToTick:

  • Will return false on it and go on to the next object

Putting into Tick:

  • Will check IsAllowedToTick
  • then will check if always ticks OR IsTickable
  • then will check parent world
  • then will check engine context
  • then will check if can tick while paused
  • then finally will call Tick
  • then your ‘Tick if’ will return out and do nothing after all this above

So imho there will be performance difference, increasing with the number or instances. Ofc neglible if only a few uses this.

1 Like

good find, thanks