Nenhuma descrição
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

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. }