x

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"

Best way to loop a function?

What't the most efficient way to loop a function every frame while I needed it? Would using the "set timer by event or function name" on loop be the best? Or would using an event track timeline to loop a function work better and be more performant? Event tick is out of the question. Any pointers?

Product Version: UE 4.11 Preview
Tags:
more ▼

asked Jan 25 '16 at 04:19 AM in Blueprint Scripting

avatar image

RyanSergent
18 3 4 6

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

1 answer: sort voted first

"What't the most efficient way to loop a function every frame while I needed it"

Only tick can do that, the rest is time based and you have no guaranty it will run on each frame. Also timers as i know runs game thread same as tick so it will effect performance either way. You could try making your own thread, but thats C++ only.

Most efficient way to loop on each frame is to use Tick efficiently (do stuff only if it's needed) and if you can code it in C++. And you don't need to be scared of Tick, it a event that drives entire game and set actors in motion, all you need to do is to fit in 16ms for 60FPS, you can check "Blueprint Time" and tick times in "stat game" command and profiler (Window->Devloper Tools->Session Frontend). Also tick is multithreaded, each tick group is executed in max 8 threads and each tick of actor of a single group are queued evenly in all threads (atleast thats what i seen in code, i dont know if this is enabled by default i seen single thread mode there too), so if you put that in account tick is more efficient then other interval events.... it needs to be as it drives your game

If you want feather help explain what exacly you want to do, each case is different.

more ▼

answered Jan 25 '16 at 05:40 AM

avatar image

Shadowriver
37.8k 937 172 1123

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

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

Answers to this question