Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by jimbobuk · Feb 28, 2010 at 06:15 PM · iphoneframerate

iPhone - Can i tell Unity to run at 60hz rather than 30hz?

I was about to try using

Application.targetFrameRate

till I realised it wasn't present in the iPhone documentation so i presume doesn't exist.

I was keen to try seeing how well my app can go on my 3GS as i'm optimising it to try and reach 30 on older devices. Running at 60hz on >= 3GS would be a nice gain, and improvement for these newer more powerful devices.

Still without that variable, i'm presuming i can't set the speed to anything different than the current ~30hz framerate, unity is using?

I've noticed that there is a kFPS #define in AppController.mm, i presume this can be used? Has anyone had any success with it? It's a bit frustrating as i'd like to scale the target fps by device type. Though i do have Unity iPhone Advanced, being a define and used in some constant variables in AppController.mm i'd presume it'd still be fiddly to expose this in any nice form. Perhaps a better option would be adding switch on device type into AppController.mm directly.. but then the patch would be vulnerable to being overwritten by Unity. Hmm.

Cheers

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jkgd · Nov 13, 2012 at 09:53 AM 0
Share

efge mentions below that, "Since 3.5(?) you should use Application.targetFrameRate."

3 Replies

· Add your reply
  • Sort: 
avatar image
8

Answer by Thom Denick · Jul 15, 2010 at 05:11 PM

Here's a step by step breakdown of how to revise your AppController.mm's framerate, for those not comfortable in X-Code.

  1. Build your project in Unity by select Build & Run from the File menu.
  2. Let your app launch in X-Code on your iDevice.
  3. Once your app has launched alt-tab to X-Code.
  4. On the left side of your project in X-Code, you should see a bunch of folders. Click the small arrow next to "Classes" to expand the folder.
  5. The second file in Classes should be "AppController.mm" this is the file you want.
  6. Click on the file, and the contents should display in the main panel.
  7. UNITY has done a fantastic job setting this file up, and all you have to do is change one constant - kFPS.
  8. To find kFPS Hit MacKey + F and search for 30 or kFPS. In my AppController, it is line 97.
  9. Change the "30.0" to "60.0" or whatever max frame rate you want.
  10. Save the file, and return to Unity.
  11. Now, once again select "Build and Run." Unity will have noticed the change and prompt you to save your build. Save in the same area (default) area, and Unity will ask if you want to Replace or Append the project there.
  12. Select Append, and Unity keeps your modified AppController.mm and builds a new version of your game with your new frame rate cap!

Thanks for the help Eric!

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Anxo · Sep 07, 2010 at 02:07 PM 0
Share

I had the same problem, this answer was very useful.

avatar image fireDude67 · Dec 15, 2010 at 12:50 AM 0
Share

That is a lot of steps...

avatar image
3

Answer by efge · Aug 24, 2012 at 03:32 PM

Since 3.5(?) you should use Application.targetFrameRate.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
2

Answer by Eric5h5 · Feb 28, 2010 at 06:56 PM

Yes, changing kFPS in AppContoller.mm is how you set the framerate. If you use Append when building instead of Replace (or use Command-B for build-and-run), then AppController.mm and other changes you might have made are not overwritten.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jimbobuk · Feb 28, 2010 at 08:05 PM 0
Share

thanks. It'd take quite a large rewrite to refactor it out into a variable that you can then override depending on what device is running it. Wouldn't know where to begin on detecting the device. I'll try and push a build out onto my 3GS and see whether it's able to hold at 60hz.

Cheers

avatar image Eric5h5 · Feb 28, 2010 at 08:14 PM 0
Share

Detect the device by using iPhoneSettings.generation.

avatar image jimbobuk · Feb 28, 2010 at 10:58 PM 0
Share

thanks Eric5h5, how can i do this in the objectiveC of AppController.mm though? I fear its not that simple but they'll definitely be a way.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Is there a way to create applications that run on fixed frame rate of 60fps on iOS? 1 Answer

Is it possible to get above 30 FPS on an iOS device? 5 Answers

getting back my fps 3 Answers

Low fps with only a few characters? 2 Answers

Poor fog performance on the iPad? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges