Unlock framerate on iOS from 30fps?

Hi guys, I’ve been working in “Next Gen” game development as a part of a large team for years, but never actually made my own before. And I’ve never worked on iOS before. So I’m having a little trouble with some of the basics.

For now I’m just stumbling on one main thing though.

I’m using the frame rate to gauge performance, which is very important to me since I’m used to using more complex shaders and higher res models. I’m using a simple framerate counter that I found on the Unify Wiki.

However it appears that the framerate is locked at 30fps when I build something on my iPhone. Is this a limitation on the iPhone? I can’t find a setting for it anywhere in Unity.

Any ideas?

Thanks
Dave

In your Xcode project, open Classes/AppController.mm and change:

#define kFPS 30.0

to whatever you want. Note that there is no reason to put it above 60, as iOS devices refresh at 60Hz and use v-sync.

There’s also not much reason to use anything other than 30 or 60, because of the vsync thing. 15 would work but is pretty choppy.

–Eric

Does that #define imply that, no matter what performance-bound improvements I make to my code/assets/gameObjects/game/etc., I’m never ever going to see an FPS rate higher than 30 on iOS devices if I don’t change it to something else?

Also:

I’m sure Wikipedia would help me understand the v-sync thing and why 30 and 60 are the only really useful refresh rates on iOS, but since we’re on the topic I might as well as here too :wink: What happens if I set the #define to, say, 52 even if only for the kicks?

Thanks for the help! Regards,

  • jmpp

Well, i usually set #define kFPS 60.0.
Then i put a simple FPS Counter in my Project. Now i do my tests to see, how fast or slow it runs. I do some tests with toggles, like switching some Gameobjects on and of and can see how much this affects performance. Especially on iPd that helps to immediately see how much FPS a certain something will cost.

In the end, let´s say your game runs average at 42 FPS. Then you might want to cap to kFPS 30.0. This will save some battery, and avoid some choppiness.