'Trigger once VS Every frame' performance?!

I’m guessing using ‘trigger once’ is better for performance right?

Because trigger once runs once and that’s it but events without trigger once will run every frame forever.

Which one is better for performance?? :thinking: :thinking:

It’s not about performance, it’s about what you are trying to achieve. Trigger once ensures that an action only gets run once if the conditions are met, until they are no longer met when the trigger is ‘reset’.

A keypress to shoot is a trigger once candidate. A keypress to move is most likely not.

So doesn’t it really affect performance??

I was thinking to use ‘trigger once’ as much as possible if it is helpful for optimization.

(Because I don’t often add trigger once to events. (Such as, defining variables, etc.))

It depends on what you are doing.

Writing to a text object won’t impact performance.

Reading or writing to a file/storage will impact performance if not done conditionally.

So a the answer to “is it better for performance” answer isn’t that straight forward.

If the conditions change as soon they are met (say like mouse button or key releases) then a trigger once makes no difference.

You need to think about what the event is doing, rather than just slapping a trigger once whenever possible.

1 Like

Ah ha!! I get it!! So it is situational!

Thank you so much siiiir!! :blush: :blush: :blush: :+1: