iOS fixed to 30 fps. Application.targetFrameRate doesn't help!

Hello,

After several days of porting my project to iOS from Android, I was finally able to build and run it on my mobile and tablet.

However, fps of all my games stays the same - 30 fps. I am sure it’s affixed and not because of performance: 1) because my Android device run it at 60
2) Because it doesn’t get any higher or lower…at all!

After searching the net I found out that this is a common issue, which can be fixed by using Application.targetFrameRate
However, I couldn’t compile build my project (in Xcode). It gives me hundreds of warnings (most of them are depreciated functions) and 71 error messages (which didn’t make sense to me at all).

There was another method I found on forums, which is to hack around ApplicationController.mm file to include #define kFPS 60.0.
For some reason, I don’t have such file! Instead I have UnityApplicationController.mm. Putting the line of code inside didn’t have much of effect at all.

In a nutshell:

  • My game locks at 30 FPS
  • Application.targetFrameRate is not working
  • ApplicationController.mm is missing as well
  • I am using mono2x scripting backend (not IL2CPP)

Software I am using: Xcode 7 Beta 5, Unity 5.1.2f1, OSX Yosemite (latest).
Mobile devices I am using are iPhone 5s, iPad Mini

Did anyone had these issues?

Thanks in advance!

1 Like

Anyone?

I assume it is an IOS optimization to preserve battery life. Probably you can find your way to hack to it but as long as your game doesn’t need more than 30 fps, move along and make another game. Because 60 fps is a huge increase in batter consumption. There was a video about mobile optimizations and they actually recommend capping fps in mobiles.

Actually capping your android games to 30 fps might be a better alternative :slight_smile:

60fps feels so much better, even on mobiles, so if he is targeting 60fps, he is targeting 60fps. Plus, “oh well 30fps is fine” is not a solution to “why isn’t Application.targetFrameRate working?”.

The #define kFPS thing is very very old, it’s not used anymore. It was relevant during Unity 3.x era.

Where are you running Application.targetFrameRate? It should be running in Awake() in a script in your first scene.

4 Likes

Using Application.targetFrameRate = 60 is correct, and works on iOS just fine. The issue is not that, it’s your Xcode project not compiling.

–Eric

1 Like

Can confirm that Application.targetFrameRate works on iOS, both in 4.6.x and 5.x.

Now if you’re on a slow device, say an iPhone 4, you probably won’t get 60fps out of even the most simple scene.

If you’re on a mid-range device and have any of the default per-pixel lit shaders, you’re unlikely to get 60fps either.

Related topic: Lower framerate on iOS since Unity 5 - Unity Engine - Unity Discussions

Hi there.

I’m having the exaxct same problem.

I need 60fps but Application.targetFramerate is not working at all, no matter how I configure things, I always get 30fps, this is running on an iPhone 6S and a pretty simple scene, ideas?

How can I force FPS in xcode instead of inside Unity?

Cheers.

I can’t reproduce this issue. Could you please re-check whether the function that sets Application.targetFramerate actually runs? Also, which version of Unity are you using?

@Juang3d , had the same issue. I set Application.targetFramerate = 40 and it did the trick. Post that I was getting 60 fps on all intended devices. Don’t ask me how or why it worked, because i don’t know. Maybe you could give it a try

If you forget to set dont v’sync then Application.targetFramerate is not working.

1 Like

try to set your targetFramerate to 120 and it will fall back to 60fps. tried it on iOS 10 and Unity 5.5.2

IOS does not support 120 FPS. 60 is the max and by default it is 30.

Hi, usually the framerate will be “locked at 30” if it is under 60. For example 59fps becomes 30fps. This is why it will feel constant to most people. The cause of it will likely be vsync which cannot be altered on iOS. You have it on and that is all.

So, you can’t have 55fps. You can have 60, 30, 15 as a typical range. If you are lower than 15, probably you need to learn 2 dev :stuck_out_tongue:

2 Likes

60/30/20/15, to be super-exact (the best kind of exact). :wink:

–Eric

4 Likes

can we set it to 45? 30 is not enough for my game,60 is too much battery consumption,
45 ideal for me. is it possible?

I don’t know if setting it to 45 does anything, but if it works, for most phones what it will result in is it switching back and forth between 60 and 30 and it will look stuttery and bad.

But also, people have been doing 60fps games on mobile for many years now. It’s doable.

ah okay, then I will use 60 fps. thank you

The best solution we came up with was to have a 30fps limit in our options menu, in case people care about the battery, but we default to 60fps.