Search Unity

What framerate is applied when using frame-by-frame in editor?

Discussion in 'Editor & General Support' started by SVC-Games, Jul 7, 2017.

  1. SVC-Games

    SVC-Games

    Joined:
    May 21, 2013
    Posts:
    113
    We all are familiar with the "frame-by-frame" button in the editor. But what framerate is "used" when clicking this button? I suspect Unity updates the scene as if the game were running at 60fps but is it a constant value?
     
  2. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,412
    I just did a test with 5.6.2p2 and oddly it seems to be about 50fps.

    I just added:

    Code (csharp):
    1.  
    2.     private float t=0;
    3.     void Update()
    4.     {
    5.         float frameTime = (Time.time - t);
    6.         t = Time.time;
    7.  
    8.         Debug.LogFormat("Time since last frame: {0}, fps: {1}", frameTime, 1/frameTime);      
    9.     }
    Time since last frame: 0.01999998, fps: 50.00005

    For every "frame-by-frame" click.
     
  3. SVC-Games

    SVC-Games

    Joined:
    May 21, 2013
    Posts:
    113
    I don't rely too much on time when on framy by frame because I get weird results sometimes (as in "it gives me the time between presses instead of some kind of "frame time"), that's why I was asking for a number... as you say 50fps is weird, let just hope that we get an official response because it kind of breaks the usefulness of frame by frame if it doesn't work at something more standard like 60fps :p
     
  4. larku

    larku

    Joined:
    Mar 14, 2013
    Posts:
    1,412
    A little more testing shows it will use what ever you have set in the Edit->Project Settings->Time: Fixed Timestep
     
  5. SVC-Games

    SVC-Games

    Joined:
    May 21, 2013
    Posts:
    113
    Um, that's actually interesting. Setting that to 0.1666667 would be akin to 60fps. Although for final release it should be changed back to the default value I guess...
     
    larku likes this.
unityunity