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.

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#)

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

Keep in mind thats just example of using DeltaSeconds :stuck_out_tongue:

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

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

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 :smiley:

No problem :slight_smile: