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.

ClusterInfoTest.cs 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.AdaptivePerformance;
  4. using UnityEngine.UI;
  5. public class ClusterInfoTest : MonoBehaviour
  6. {
  7. IAdaptivePerformance ap;
  8. public Text big;
  9. public Text med;
  10. public Text little;
  11. public Text notSupported;
  12. public ClusterInfo ClusterInfo;
  13. void Start()
  14. {
  15. ap = Holder.Instance;
  16. if (ap == null || !ap.Active)
  17. {
  18. Debug.Log("[AP ClusterInfo] Adaptive Performance not active.");
  19. return;
  20. }
  21. if (!ap.SupportedFeature(UnityEngine.AdaptivePerformance.Provider.Feature.ClusterInfo))
  22. {
  23. notSupported.gameObject.SetActive(true);
  24. Debug.Log("[AP ClusterInfo] Feature not supported.");
  25. }
  26. ClusterInfo = ap.PerformanceStatus.PerformanceMetrics.ClusterInfo;
  27. AssignClusterInfo(ClusterInfo);
  28. }
  29. private void Update()
  30. {
  31. if (ap == null || !ap.Active)
  32. return;
  33. var clusterInfo = ap.PerformanceStatus.PerformanceMetrics.ClusterInfo;
  34. if (ClusterInfo.BigCore != clusterInfo.BigCore || ClusterInfo.MediumCore != clusterInfo.MediumCore || ClusterInfo.LittleCore != clusterInfo.LittleCore)
  35. {
  36. AssignClusterInfo(clusterInfo);
  37. }
  38. }
  39. void AssignClusterInfo(ClusterInfo clusterInfo)
  40. {
  41. big.text = $"Big: {clusterInfo.BigCore}";
  42. med.text = $"Medium: {clusterInfo.MediumCore}";
  43. little.text = $"Little: {clusterInfo.LittleCore}";
  44. Debug.Log($"Cluster Info = Big Cores: {clusterInfo.BigCore} Medium Cores: {clusterInfo.MediumCore} Little Cores: {clusterInfo.LittleCore}");
  45. ClusterInfo = clusterInfo;
  46. }
  47. }