[Closed] Triggers vs. On Event Tick
What is the actual trade off in efficiency between using a Trigger and using OnEventTick?
The way I understand, a trigger will still have to be checked ever tick until the conditions to fire it are true. If that is the case, how is that more efficient? I am just trying to wrap my head around what is going on under the hood here so that I can make better decisions with how my game is implemented. A vague "Don't use OnEventTick unless absolutely necessary" or "Use timers instead" is not very informative.
asked Nov 10 '14 at 05:16 AM in Blueprint Scripting
The question has been closed Dec 29 '14 at 06:26 PM by RAVaught for the following reason:
The question is answered, right answer was accepted
As far as I can see, the code that checks if a trigger should be fired or not is in C++, which means its already complied to machine code.
But the tick function is defined by you and since we are talking about blueprints, the logic inside the Tick() event is not compiled into machine code, instead it is in an intermediate state.
This would mean a trigger is more efficient than doing the tests in Tick().
Also keep in mind that the code behind a trigger are probably low level and has access to many of the internal data structures used by the engine thus making it much more optimized than a higher level logic implemented in blueprint.
answered Nov 10 '14 at 05:44 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here