Search Unity

Maintain Fix FPS(frame persecond)

Discussion in 'Editor & General Support' started by frank45, Oct 8, 2013.

  1. frank45

    frank45

    Joined:
    Apr 23, 2012
    Posts:
    26
    i was wondering if i can control the fps of the game.
    Assuming i have processor which is giving more than enough FPS,lets say 60.
    But i want to render it at only constant 30fps.

    Is that possible by any chance?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    You can use Application.targetFrameRate. 30 is very low, though; don't do that. It's generally better if you just use vsync.

    --Eric
     
  3. frank45

    frank45

    Joined:
    Apr 23, 2012
    Posts:
    26

    i wrote something like this..

    function Start () {
    QualitySettings.vSyncCount = 2;
    }

    still i am getting fps between 35-39 i want it to be near about 30.
     
    Last edited: Oct 8, 2013
  4. Nition

    Nition

    Joined:
    Jul 4, 2012
    Posts:
    781
    If you want an exact framerate at all times, you could use Application.targetFrameRate to set what you want, and then do your stuff in FixedUpdate instead of Update. Beware that this'll be bad if your computer ever can't keep up though.