What is more efficient, Tick or Timer?
Question, Cannot find an answer for this any where!
Which of the following would be more efficient on say an escalator moving? In this Epic training video to create an excalator he uses tick: https://www.youtube.com/watch?v=aqRUe7pm4Ok I have watched a few training Videos from Epic that say to never use tick because it is so inefficient. In the comments of one of the videos I asked what you are supposed to use for a line trace if you cannot use tick, but no one responded. I ended up changing my line trace to use Event Timer set to loop at second = .01, would it be better to use an Tick instead of the Event Timer? I changed the Event Timer to .1 but it was too sluggish and had to change it back to .01.
2) Event Timer set to loop at second = 1
3) Event Timer set to loop at second = .1
4) Event Timer set to loop at second = .01
I think what this video was stateing is Using tick in blueprint is not efficient because blueprint VM is around 10 slower then native code in C++, and you only have 16ms to update game state for next frame in case of 60fps and all ticks needs to be fully executed to finish the frame, the more fps the time is even smaller. That why doing heavy operations on tick in blueprint is not recommended and you should move that in C++, but even there you need to watch out and don't do things like actor iteration (same things that "Get All Actors of Class" does)
There no difference between timer or tick if time is smaller then frame rendering time, so if you gonna do 0.01 which is 10ms it will execute in same rate as tick and take same amount of performance on 60fps, you need to do it higher time or else it does not make much sense. But keep in mind that timer depends on ticking to, there no sense of time in CPU, the way timer works that on each frame (same as tick is called), timer system checks if time has passed, if yes call binded function/event, so with using a little bit higher time and you care about precision function might be called in irregular way, using timer on small time is kind of iffy. Executing code every 2nd or 3rd tick is also viable option but it's frame dependent. So it really depends on what you trying to do.
In general if you want operation to run on every frame or time same or smaller then rendering timer then use of tick is better option
Follow this question
Once you sign in you will be able to subscribe for any updates here