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"

Overriding Tick() Inefficiency

In most of the tutorials and examples I've seen, developers really like to override the Tick() function to change default behavior. However, since this is a function that gets called every frame, that seems horribly inefficient. Generally speaking shouldn't there be a better place to override default behavior? Why is overriding Tick() the default for so many developers?

Many thanks,

Mason

Product Version: Not Selected
Tags:
more ▼

asked May 12 '15 at 07:11 PM in C++ Programming

avatar image

J272
1 1 2 2

avatar image MickD777 May 12 '15 at 08:47 PM

Overriding tick is needed if you want to do stuff that execute every frame. If you want something to happen only once at actor start, you can override BeginPlay().

Overriding Tick() is common, since a lot of Actor NEED to be updated every frame (actor movement for example, if you want it to be smooth, a timer, lerp functions, etc).

If you want an actor to be updated every 2 frame, it's alsopossible, either via using timers or with checks in the tick function.

I'm not sure I understand your question, because overriding tick is normal, you just have to make sure what you put in there really needs to be checked every frame.

I hope this answers your question.

avatar image J272 May 12 '15 at 09:36 PM

That does answer most of my question. I've just noticed a number of people overriding Tick() for things that should only be done once. I wasn't sure if there was some functionality in Tick() other than its call frequency that wouldn't be available in something like BeginPlay(). Your response certainly confirms my suspicion that there are just plain bad developers out there ;-)

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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