浏览代码

Improved framerate lock script

/dots-physics
mikegeig 5 年前
当前提交
4603222f
共有 1 个文件被更改,包括 18 次插入3 次删除
  1. 21
      Assets/Scripts/Utility/PlatformFramerateLock.cs

21
Assets/Scripts/Utility/PlatformFramerateLock.cs


public class PlatformFramerateLock : MonoBehaviour
{
// Start is called before the first frame update
public int highEndRate = 60;
public int highEndPhysRate = 60;
public int lowEndRate = 30;
public int lowEndPhysRate = 30;
//Basic for now. Replace with the platform logic
Application.targetFrameRate = (int)(1f / Time.fixedDeltaTime);
int rate = 60;
int physRate = 50;
#if UNITY_STANDALONE || UNITY_EDITOR || UNITY_XBOXONE || UNITY_PS4
rate = highEndRate;
physRate = highEndPhysRate;
#else
rate = lowEndRate;
physRate = lowEndPhysRate;
#endif
Time.fixedDeltaTime = 1 / physRate;
Application.targetFrameRate = 1 / rate;
}
}
正在加载...
取消
保存