public static void SetTargetFrameRate(int frameRate) { if (frameRate == 0) { if (singleton != null) { DestroyImmediate(singleton); singleton = null; } targetDeltaTicks = 0; return; } targetDeltaTicks = Mathf.RoundToInt(1000f / frameRate + BONUS_TICKS); if (singleton != null) { return; } var go = new GameObject("TargetFrameRateFix"); go.AddComponent <TargetFrameRateFix>(); go.hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector | HideFlags.NotEditable; }
void Awake() { if (singleton != null) { DestroyImmediate(this); return; } singleton = this; DontDestroyOnLoad(this); prevTicksSinceStartup = timeGetTime(); }
public static void SetTargetFrameRate(int frameRate) { if (frameRate == 0) { if (singleton != null) { DestroyImmediate(singleton); singleton = null; } targetDeltaTicks = 0; return; } targetDeltaTicks = Mathf.RoundToInt(1000f / frameRate + BONUS_TICKS); if (singleton != null) return; var go = new GameObject("TargetFrameRateFix"); go.AddComponent<TargetFrameRateFix>(); go.hideFlags = HideFlags.HideInHierarchy | HideFlags.HideInInspector | HideFlags.NotEditable; }