- Home /
targetFrameRate & vSync for iOS
Heya folks..
I was wondering, does Application.targetFrameRate, works on iOS? In the docs it says:
If vsync is set in quality setting, the target framerate is ignored, and the vblank interval is used instead. The vBlankCount property on qualitysettings can be used to limit the framerate to half of the screens refresh rate (60 fps screen can be limited to 30 fps by setting vBlankCount to 2)
And in the Unity Answers i read, that vsync is allways ON, for iOS and cannot be turned off....
The interesting thing is if i turn it Off and set targetFrameRate to 30, the game runs on exactly 30FPS (Where it was running with 50FPS, before that).
SO what's right and what's wrong?
Can i turn Off vSync for iOS? If no, then this means that targetFrameRate is useless? If so, how can i tell the game to run at specific frame rate? That was the first question.
Shoud i limit the FPS, by setting the VSync Count to "Every Second VBlank" ?
Second one: My game runs on iPad4, iPhone5 with 50, 60 FPS, and on iPad Mini, iPod touch with 30, 45 FPS. Shoud i limit the game to 30FPS, or i shoud leave it to decide by it's own, on what FPS to run. Apparently the Unity engine is doing some stuff behind, cuz if i don't limit it the game runs pretty well...
thanks
Answer by Eric5h5 · Oct 08, 2014 at 12:53 AM
iOS devices are always vsynced and that can't be changed. By default the framerate is capped at 30; you can use Application.targetFrameRate to change it to 60.
Then coud you explain this please:
If vsync is set in quality setting, the target framerate is ignored, and the vblank interval is used ins$$anonymous$$d. The vBlankCount property on qualitysettings can be used to limit the framerate to half of the screens refresh rate (60 fps screen can be limited to 30 fps by setting vBlankCount to 2)
The docs aren't talking about iOS, they're talking about standard PC builds.
Answer by bererton · Oct 07, 2014 at 07:36 PM
Hi instruct9r,
I was running into some of this today myself. My experience with Unity Beta 4.6b18 is that setting Application.targetFrameRate does indeed work on the iPhone. At least it worked for me if I set it to 60. Without setting that I was unable to change the frame rate to be higher than 30fps on iPhone 5/ or 6. Other threads have commented that vsync with Unity can be problematic sometimes (which for me seems to lead to jerky motion just moving a sprite around in a 2D game).
In terms of choosing a frame rate I think if it can run faster, why not let it run faster. As long as your game is frame rate independent it should be fine, assuming of course you don't have random frames with huge times here and there causing rough/jerky frame rate.
hmm Yes $$anonymous$$aybe. Allthough for now i am limiting to 30, cuz as far as i understand 50, 60 FPS, is going to suck the battery of the device prettty quickly, especially for 3D graphics (Like in my case).
Are you manually turning Off vSync before building for iOS or you are leavint it on... I also noticed, that the targetFrameRate works, just fine.
Answer by IgorAherne · May 31, 2018 at 02:39 AM
Also, would like to point this out (post #7) https://forum.unity.com/threads/device-present-in-profiler-what-the-deal.86312/#post-564383
Your answer
Follow this Question
Related Questions
Why target frame rate either 60 or 30, how about 50? 3 Answers
Android/IOS First Person Shooter 2 Answers
IOS Gun shooting script 1 Answer
iPad 3 is at 1 fps while even iPad 2 is running above 10fps 0 Answers