Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by noonche · Feb 04, 2014 at 06:34 AM · editorframerate

Application.targetFrameRate doesn't work in the Editor?

I seem to get wildly fluctuating frame-rates in the editor (200-500) and this results in very jerky motion. This happens even when I set Application.targetFrameRate to 60 and QualitySettings.vSyncCount to 1.

If I make an actual windows build, these settings take and everything is nice and smooth. So, is there a way to make targetFrameRate work in the editor?

Right now iterating on controls and motion in the editor is extremely frustrating.

Comment
Add comment · Show 3
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 zee_ola05 · Feb 04, 2014 at 06:37 AM 0
Share

If you're getting jerky motion, maybe you're putting your movement code in Update() ins$$anonymous$$d of FixedUpdate()?

avatar image Eric5h5 · Feb 04, 2014 at 07:14 AM 0
Share

You're supposed to put movement in Update. FixedUpdate is only for physics, and will result in jerky movement if you put code in there (unless the physics framerate exceeds the screen framerate).

avatar image CHPedersen · Feb 05, 2014 at 08:12 AM 0
Share

Eric's answer should explain Application.targetFrameRate. As for QualitySettings.vSyncCount, beware that Unity, as a client application, cannot overrule driver settings. VSync can be controlled externally in your driver control software. Check the setting there, too. If you have an NVidia card, its name is "NVidia Control Panel". I think it's called "Catalyst Control Center" for ATI cards. It should ideally be set to use Application Settings, so that client apps like Unity get to define their own.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Eric5h5 · Feb 04, 2014 at 07:20 AM

As the docs say, targetFrameRate is ignored in the editor. You can use vsync (which should work—it does here). If you're looking at the stats window, that's how long it takes to draw the graphics, which isn't necessarily the actual fps. You can use an fps counter script to see the real fps if necessary.

Comment
Add comment · Show 4 · 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 noonche · Feb 05, 2014 at 07:47 AM 0
Share

Yeah, I made an FPS counter script using System.Diagnostics.Stopwatch to check how many times Update gets called in a frame. I'm getting wildly varying frame-rates even with v-sync enabled.

avatar image Eric5h5 · Feb 05, 2014 at 08:03 AM 0
Share

Update is always called once per frame, by definition.

avatar image CHPedersen · Feb 05, 2014 at 08:07 AM 1
Share

Although you can, don't use Stopwatch for this. That's kind of the "long way around". The framerate is just 1 / Time.deltaTime. I use this, which can be added to any script (provided it does not already define OnGUI):

 #if UNITY_EDITOR
 // Writes the rendertime and actual FPS for debug purposes in the editor
 private void OnGUI()
 {
     GUI.Label(new Rect(0, 50, 200, 50), new GUIContent("Time taken to render previous frame: " + Time.deltaTime));
     GUI.Label(new Rect(0, 100, 200, 50), new GUIContent("Frames per second: " + 1 / Time.deltaTime));
 }
 #endif

There's a bit of platform dependent compilation there, to prevent the text from showing up in builds. It will display only in the editor.

avatar image Eric5h5 · Feb 05, 2014 at 08:32 AM 0
Share

Use this: http://wiki.unity3d.com/index.php?title=FramesPerSecond That way you have a readout of the average fps over the previous half-second, so it doesn't vary every frame.

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

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity editor low frame rates and flashing while pressing keys 1 Answer

Updated to 2021.3.3, why did my FPS drop significantly? (over 350fps) 0 Answers

Why is my build running so slow despite running fine in editor? 2 Answers

HDRP Reflection probes cause terrible framerate 2 Answers

Limit FPS in the editor? 1 Answer


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