Do I need to check this boolean every tick?

It may be simplest to just check the flag every tick if once the flag is true they it really is something that needs to be done in tick.

But, if it’s something that doesn’t need to be done every tick once the flag is true then it would be better to use a timer. You can set a timer to check if the condition is true every x time, if it is, then it can do the operation.

It’s probably best just to check the flag every tick. Abstracting away from it, will have it’s own cost.

Hi There,

Quick question. If I have a function that needs a tick, but the function only needs to be executed under specific conditions, do I leave a boolean check running on the tick at all times, or is there a better way to do this?

Any insight is appreciated. Thanks.

Edit: To be clear, the boolean itself doesn’t need to be checked every tick, but once it’s true, the function will need the tick.

Yes, to be clear, once it’s true, it does need the tick. I just don’t need to check the flag every tick, if that makes sense.