Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

CLILeakDetectionSwitcher.cs 1.2KB

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using UnityEditor;
  3. using Unity.Collections;
  4. using UnityEngine;
  5. class CLILeakDetectionSwitcher
  6. {
  7. [InitializeOnLoadMethod]
  8. static void SetLeakDetectionModeFromEnvironment()
  9. {
  10. var nativeLeakDetectionMode = Environment.GetEnvironmentVariable("UNITY_JOBS_NATIVE_LEAK_DETECTION_MODE");
  11. if (!string.IsNullOrEmpty(nativeLeakDetectionMode))
  12. {
  13. switch (nativeLeakDetectionMode)
  14. {
  15. case "0":
  16. NativeLeakDetection.Mode = NativeLeakDetectionMode.Disabled;
  17. break;
  18. case "1":
  19. NativeLeakDetection.Mode = NativeLeakDetectionMode.Enabled;
  20. break;
  21. case "2":
  22. NativeLeakDetection.Mode = NativeLeakDetectionMode.EnabledWithStackTrace;
  23. break;
  24. default:
  25. Debug.LogWarning("The environment variable UNITY_JOBS_NATIVE_LEAK_DETECTION_MODE has an invalid value. Please use: 0 = Disabled, 1 = Enabled, 2 = EnabledWithStackTrace.");
  26. break;
  27. }
  28. Debug.Log("Native leak detection mode: " + NativeLeakDetection.Mode);
  29. }
  30. }
  31. }