Best way to update at a regular interval?
So, I'm making a fighting game that requires everything to update on a frame by frame basis. That means everything has to update every 1/60th of a second without fail, and that means animations as well. I was using FixedUpdate but some reading lead me to believe that it's not as reliable as the docs made it sound.
So my question twofold: 1) What would be the most efficient way to handle updates at a fixed, regular interval 2) Is there a cost efficient way to force the animator to update at the same time as the rest?
Thanks a lot
You're best bet is to use Update. It's called once per frame. https://docs.unity3d.com/$$anonymous$$anual/ExecutionOrder.html
Answer by Pengocat · Jan 12, 2017 at 08:43 PM
You cannot guarantee 60 frames a second, but you may down prioritise things that are less crucial to skip some frames so you're more likely to stay on or above 60 frames a sec. A good practice would be to keep the overall workload of the GPU and CPU at a somewhat stable level. Spikes should be dealt with when optimizing.
That's all well and good, but unfortunately even keeping a solid 60 fps does not mean FixedUpdate will fire at fixed intervals. And I absolutely need an update every 1/60th of a second
It is a limitation every game developer has to deal with. There is no magic way of getting 60 fps but when dealing with time sensitive calculations like physics it can guarantee that it will perform its calculations a fixed amount of times by time passed since the last frame. So if you have 30 fps Fixed update would be called twice every frame etc. As far as I'm aware Unity handle the Animation update in the same thread as $$anonymous$$onobehavior. Only PhysX and perhaps sound is handled in other threads.
Your answer
Follow this Question
Related Questions
Animation Won't Play Before My Time Freeze. 0 Answers
Make something happen at a specific time in a looping animation 1 Answer
Maximum Delta Time 0 Answers
HELP,Watched tutorial https://www.youtube.com/watch?v=Xnyb2f6Qqzg 1 Answer
Why is my animation being started, but is not actually playing? 1 Answer