FpsStatistics.cs 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Runtime.InteropServices;
  2. using UnityEngine;
  3. namespace Nxr.Internal
  4. {
  5. public class FpsStatistics : MonoBehaviour
  6. {
  7. NibiruService mNibiruService;
  8. TextMesh textMesh;
  9. // Use this for initialization
  10. void Start()
  11. {
  12. textMesh = GetComponent<TextMesh>();
  13. if (NxrViewer.Instance.ShowFPS)
  14. {
  15. mNibiruService = NxrViewer.Instance.GetNibiruService();
  16. if(mNibiruService != null)
  17. {
  18. mNibiruService.SetEnableFPS(true);
  19. }
  20. } else
  21. {
  22. Debug.Log("Display FPS is disabled.");
  23. }
  24. Debug.Log("TrackerPosition=" + NxrViewer.Instance.TrackerPosition);
  25. }
  26. // Update is called once per frame
  27. void Update()
  28. {
  29. if(mNibiruService != null)
  30. {
  31. float[] fps = mNibiruService.GetFPS();
  32. textMesh.text = "FBO " + fps[0] + ", DTR " + fps[1];
  33. }
  34. }
  35. }
  36. }