No Description
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.

GetBoostUnit.cs 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #if VISUAL_SCRIPTING_ENABLED
  2. using Unity.VisualScripting;
  3. namespace UnityEngine.AdaptivePerformance.VisualScripting
  4. {
  5. [UnitShortTitle("Get Boost")]
  6. [UnitSubtitle("Get CPU and GPU Boost")]
  7. [UnitCategory("AdaptivePerformance/Performance")]
  8. public class GetBoostUnit : Unit
  9. {
  10. [DoNotSerialize]
  11. public ValueOutput cpuBoost;
  12. [DoNotSerialize]
  13. public ValueOutput gpuBoost;
  14. bool CpuBoost;
  15. bool GpuBoost;
  16. protected override void Definition()
  17. {
  18. cpuBoost = ValueOutput<bool>("CPU Boost", (flow) => { UpdateStats(); return CpuBoost; });
  19. gpuBoost = ValueOutput<bool>("GPU Boost", (flow) => { UpdateStats(); return GpuBoost; });
  20. }
  21. void UpdateStats()
  22. {
  23. if (Application.isPlaying && Holder.Instance != null)
  24. {
  25. var pm = Holder.Instance.PerformanceStatus.PerformanceMetrics;
  26. CpuBoost = pm.CpuPerformanceBoost;
  27. GpuBoost = pm.GpuPerformanceBoost;
  28. }
  29. }
  30. }
  31. }
  32. #endif