FPS.cs 540 B

123456789101112131415161718192021222324
  1. using UnityEngine;
  2. using UnityEngine.UI;
  3. using System.Collections;
  4. public class FPS : MonoBehaviour {
  5. GUIStyle myStyle;
  6. void Start()
  7. {
  8. // 正式环境打包,开启该宏,屏蔽fps显示
  9. #if FPS_DISABLE
  10. enabled = false;
  11. #endif
  12. myStyle = new GUIStyle();
  13. myStyle.fontSize = 30;
  14. }
  15. void OnGUI()
  16. {
  17. if (GameMgr.HasInstance())
  18. {
  19. GUILayout.Label(string.Format("FPS: {0} timescale:{1}", GameMgr.Instance.maxFrameTime,Time.timeScale), myStyle);
  20. }
  21. }
  22. }