설명 없음
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.

FPSUnit.cs 804B

1234567891011121314151617181920212223242526272829303132
  1. #if VISUAL_SCRIPTING_ENABLED
  2. using Unity.VisualScripting;
  3. namespace UnityEngine.AdaptivePerformance.VisualScripting
  4. {
  5. [UnitShortTitle("FPS")]
  6. [UnitSubtitle("Frames Per Seconnd")]
  7. [UnitCategory("AdaptivePerformance/Performance")]
  8. public class FPSUnit : Unit
  9. {
  10. [DoNotSerialize]
  11. public ValueOutput fps;
  12. private int FPS;
  13. protected override void Definition()
  14. {
  15. fps = ValueOutput<float>("FPS", (flow) => { UpdateStats(); return FPS; });
  16. }
  17. void UpdateStats()
  18. {
  19. if (Application.isPlaying && Holder.Instance != null)
  20. {
  21. var ft = Holder.Instance.PerformanceStatus.FrameTiming;
  22. FPS = (int)(1.0f / ft.CurrentFrameTime);
  23. }
  24. }
  25. }
  26. }
  27. #endif