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"

Equivalent to Unity's Update function?

Hi, I'm having a crash here and there when Updating things in Tick(float DeltaSeconds) function. In Unity C# I could use

 void Update()

To Update on every frame. Is Tick inappropriate to use in this way? If so, what feasible alternative do I have available? Sorry for such a newb question, but I'm asking because I can't find any info in the api ref or documentation. Thanks in advance for any help.

Product Version: Not Selected
more ▼

asked Apr 10 '14 at 11:31 PM in C++ Programming

avatar image

400 48 54 251

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

1 answer: sort voted first

Yes, Tick(float DeltaSeconds) is exact equivalent of that. But by default it is disabled, you need to place:

 PrimaryActorTick.bCanEverTick = true;

....in class constructor. DeltaSeconds is time between frames, so you can change vars based of time not frames

 Position += Speed*DeltaSeconds;

You should have no crashes so double check if your code is right, use debugger it should point you to line which cause the crash (keep in mind with C++ you compiling CPU machine code and without proper error handling if things will go wrong instead of friendly error, application will simply crash like unsafe mode in C#)

more ▼

answered Apr 11 '14 at 12:40 AM

avatar image

37.1k 935 172 1116

avatar image Clunk47 Apr 11 '14 at 12:42 AM

I was already setting bCanEverTick, but I wasn't using Speed*DeltaSeconds. I'll try that out and let u know the results. Thanks :D

avatar image Shadowriver Apr 11 '14 at 12:44 AM

Keep in mind thats just example of using DeltaSeconds :p

avatar image Clunk47 Apr 11 '14 at 12:45 AM

Yeah I know lol I meant I'd use it w/ one of my own variables.

avatar image Shadowriver Apr 11 '14 at 12:48 AM

Opss i made mestake actully it should be :p Position += Speed*DeltaSeconds as we adding speed to position. Then Speed will be variable saying "change per second"

avatar image Clunk47 Apr 11 '14 at 01:03 AM

Thanks for the clarification and the additional information. I'm not sure what happened, but I closed out the editor and rebuilt my project in Visual Studio, no more crashes. You did help me better understand what I was going for, so this is a suitable answer. Thanks for your time :D

avatar image Shadowriver Apr 11 '14 at 01:03 AM

No problem :)

(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