- Home /
Step button currently moves at 50fps, how do we change it to 60fps?
I noticed the Step button in the editor seems to be moving at a set rate of 50fps. I attached the following script to move a 1 unit sprite 1 unit to the right on the x axis per second:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveTest : MonoBehaviour
{
public Vector3 player;
// Update is called once per frame
void Update()
{
transform.position += Vector3.right * Time.deltaTime;
}
}
Real simple. Each time I press the Step button I can see the sprite moves 0.02 units to the right. Issue is I am trying to design a game around 60fps increments and would like to use the Step button to check frame by frame what the game does. As of right now, 50 step presses moves the sprite over 1 unit. I need to change this to 60 step presses to move 1 unit.
Is there a way to change this? I thought disabling VSync and setting the Application.targetFrameRate to 60 in Start(), Awake(), or even Update() methods would work but hasn't. Awake method example:
void Awake()
{
QualitySettings.vSyncCount = 0; // VSync must be disabled
Application.targetFrameRate = 60;
}
Any help, or share on how to achieve this will be helpful, and appreciated. Thank you!
Answer by MissingNo7 · Jun 20, 2020 at 10:12 PM
The closest to a solution I currently have is to go into Edit > Project Settings > Time > Fixed Timestep, which is set to 0.02 by default, and change it to 0.01666667. As there is no way I am aware of to set it to 1/60 exactly (which has an endless decimal point, 0.016666666666666666...).