- Home /
Why do rendering lags in my iPhone cause my code to break?
I have a 2D game and I need to make sure that all code is executed for every single frame.
What is happening is that the game running in my iPhone sometimes experiences lags and if important code happens during that lag, the code is somehow not executed. This results in my game bugging and becoming unplayable.
Is there a way to make sure the code is executed for every single frame, even if that means that the graphics may slow down to make sure it's execute as expected?
Thanks
Answer by tanoshimi · Feb 19, 2015 at 06:06 PM
Code placed in Update() will never get skipped - it will always be executed exactly once each frame.
Hi thanks for your response. But somehow, there is some kind of glitch and my characters end up outside of the designated area. Not sure if it's because of Debug.log's that slow down everything...
Debug logs are notoriously slow, and really only meant for testing. But that's a separate issue. Code placed in Update will never get skipped, just like tanoshimi said.
Your answer
Follow this Question
Related Questions
Find GameObject in another loaded scene 2 Answers
Collider2D Resize Based on Sprite Using Generics 1 Answer
Get the triangles of a convex mesh collider 1 Answer
OnCollisionEnter Sine Wave to Character 0 Answers
How can i hide weapon behind character sprite while he is looking up?(Top-down shooter) 1 Answer