Bez popisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ShowFPS.cs 875B

1234567891011121314151617181920212223242526272829303132
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using UnityEngine.AdaptivePerformance;
  4. public class ShowFPS : MonoBehaviour
  5. {
  6. public Text TargetFPS, CurrentFPS, RefreshRate;
  7. float frameAverage;
  8. IPerformanceStatus perfStatus;
  9. void Start()
  10. {
  11. var ap = Holder.Instance;
  12. if (ap == null || !ap.Active)
  13. {
  14. Debug.Log("[AP APC] Adaptive Performance not active");
  15. enabled = false;
  16. return;
  17. }
  18. perfStatus = ap.PerformanceStatus;
  19. TargetFPS.text = Application.targetFrameRate.ToString();
  20. }
  21. void Update()
  22. {
  23. frameAverage = 1 / perfStatus.FrameTiming.AverageFrameTime;
  24. CurrentFPS.text = frameAverage.ToString("F2");
  25. TargetFPS.text = Application.targetFrameRate.ToString();
  26. RefreshRate.text = Screen.currentResolution.refreshRate.ToString();
  27. }
  28. }