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

OnBottleneckUnit.cs 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #if VISUAL_SCRIPTING_ENABLED
  2. using System;
  3. using Unity.VisualScripting;
  4. namespace UnityEngine.AdaptivePerformance.VisualScripting
  5. {
  6. [UnitShortTitle("On Bottleneck")]
  7. [UnitSubtitle("CPU, GPU, TargetFrameRate bottleneck")]
  8. [UnitCategory("AdaptivePerformance/Performance")]
  9. public class OnBottleneckUnit : EventUnit<PerformanceBottleneck>
  10. {
  11. [DoNotSerialize]
  12. public ValueOutput bottleneck { get; private set; }
  13. [DoNotSerialize]
  14. public ValueOutput cpu;
  15. [DoNotSerialize]
  16. public ValueOutput gpu;
  17. [DoNotSerialize]
  18. public ValueOutput targetFrameRate;
  19. protected override bool register => true;
  20. public override EventHook GetHook(GraphReference reference)
  21. {
  22. return new EventHook(AdaptivePerformanceEventHooks.OnBottleneckEvent);
  23. }
  24. protected override void AssignArguments(Flow flow, PerformanceBottleneck data)
  25. {
  26. flow.SetValue(bottleneck, data.ToString());
  27. flow.SetValue(cpu, data == PerformanceBottleneck.CPU);
  28. flow.SetValue(gpu, data == PerformanceBottleneck.GPU);
  29. flow.SetValue(targetFrameRate, data == PerformanceBottleneck.TargetFrameRate);
  30. }
  31. protected override void Definition()
  32. {
  33. base.Definition();
  34. bottleneck = ValueOutput<String>(nameof(bottleneck), (flow) => "Unknown");
  35. cpu = ValueOutput<bool>("Cpu", (flow) => false);
  36. gpu = ValueOutput<bool>("Gpu", (flow) => false);
  37. targetFrameRate = ValueOutput<bool>("TargetFrameRate", (flow) => false);
  38. }
  39. }
  40. }
  41. #endif