【发布时间】:2020-05-22 02:25:29
【问题描述】:
从昨天开始,我的 Unity 游戏在 Android 设备上被锁定为 30fps。在它像 150fps 之前……我禁用了垂直同步。这是我昨天添加的唯一脚本:
public static class SaveLoadProgress {
public static void Save()
{
LevelManager levelManager = GameObject.Find ("GameManager").GetComponent<LevelManager> ();
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Create (Application.persistentDataPath + "/savedProgress.1912");
bf.Serialize(file, levelManager.levelReached);
file.Close();
}
public static void Load()
{
LevelManager levelManager = GameObject.Find ("GameManager").GetComponent<LevelManager> ();
if(File.Exists(Application.persistentDataPath + "/savedProgress.1912"))
{
BinaryFormatter bf = new BinaryFormatter();
FileStream file = File.Open(Application.persistentDataPath + "/savedProgress.1912", FileMode.Open);
levelManager.levelReached = (int)bf.Deserialize(file);
file.Close();
}
}
}
我不认为这可能是问题所在。 我将此添加到 GameManager:
void Awake()
{
Application.targetFrameRate = -1;
QualitySettings.vSyncCount = 0;
}
分析器显示:
我应该怎么做才能从 30fps 解锁?
【问题讨论】:
-
好问题。恭喜。