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