Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[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.

Product Version: Not Selected
more ▼

asked Nov 10 '14 at 05:16 AM in Blueprint Scripting

avatar image

699 44 28 68

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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

1 answer: sort voted first

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.

more ▼

answered Nov 10 '14 at 05:44 AM

avatar image

3.4k 154 51 271

avatar image RAVaught Nov 10 '14 at 06:01 AM

It would still be nice to get some speed trade offs listed between the time to check a trigger and the time to check say a single term event tick. (If cursec == maxsec dosomething, else cursec++)

avatar image mindfane Nov 10 '14 at 07:25 AM

A trigger has collision detection logic in it, so obviously its going to take more time than a simple floating point comparison in blueprint. However depending on how trigger is actually implemented, this collision detection might come for free, since UE is already doing collision detection for all the dynamic stuff anyway.

avatar image RAVaught Nov 10 '14 at 07:34 AM

I thought the same for some things, but that simple floating point comparison was what I was doing and I was told by staff that the Trigger event would be Faster than the OnEvent Tick. That is what got me thinking about it. The blueprint prior to the if statement was what I what above there. (If cursec == maxsec dosomething, else cursec++)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question