I am working on a project about Augmented Reality, I would like to send the detection result (virtual object position)via network. Depending on the data processing requirement to the next step, I want to send the data at the same frequency. I have investigated the maximum detection time and selected a value as the sending rate, then I found that there is a function called FixedUpdate in Unity which could set the fixed time step. So if I replace my original Update function by FixedUpdate. Does it mean I achieve what I want?
Update is called once per frame, however each frame can take a variable amount of time to run. one frame may take 10ms, another frame 5ms, and yet another taking 15ms. Time.deltaTime can be used so that the code can track how much time has passed since the previous frame.
FixedUpdate is a little different it’ll run 0 or more times per frame to “catch-up” from the last frame. if for example FixedUpdate is setup to run every 3ms, then using the previous example it’ll wait 10ms then run 3 times to catch up for the first frame, (1ms left over, wait 5ms. 6ms total to catch up) runs twice to catch up for the 2nd frame, (waits 15ms) runs 5 times to catch up for the 3rd frame.