- Home /
Cannot change the framerate in script by using the official example code and my fixed update rate goes up to 90
Hi all,
I've been following this official example code to test the update rate and Fixedupdate rate of my unity project.
[Update rate VS Fixedupdate rate][1]
However, by uncommenting the following line: Application.targetFrameRate = 10 in the code, the framerate doesn't drop at all(the GUI displays Update around 50 and Fixedupdate 51![alt text][2]). Could you please do my a favour? Why is it like this?
// Uncommenting this will cause framerate to drop to 10 frames per second.
// This will mean that FixedUpdate is called more often than Update.
Application.targetFrameRate = 10;
Another issue is when I test this code on a high performance machine. The the GUI displays Update around 90 and Fixedupdate 90. Why the Fixedupdate rate can be 90? Shouldn't it be 50HZ ? Thanks a lot [1]: https://docs.unity3d.com/ScriptReference/MonoBehaviour.FixedUpdate.html#:~:text=FixedUpdate%20executes%2050%20times%20per,using%20System. [2]: /storage/temp/167553-capture.png
Thank you so much for your great help. $$anonymous$$y target is to fix the update rate of my Unity project at 120 fps or 150 fps. When using fixed update, the rate is 60 FPS only. However, When it come to using Application.targetFrameRate, it says Setting targetFrameRate only set the target frame rate but does not guarantee that frame rate will be achieved. related post Is there a way for me to fix the update rate at 120 HZ or 150HZ?
Answer by sevdigim1451 · Sep 15, 2020 at 09:03 AM
Actually I don't know so this topic than professionals but I tested that whenever if I write the code in update, update is slow from fixed update and if I want to put slow an normal time line I use Time.deltatime. So fixed update already use for all computers shall work same frequency.(My english not so good)May be you can see , if you test game in fixed update in different computers.Already Time.deltatime use for this. I hope help to you.