Beispiel #1
0
 static void SwitchUseJobThreads()
 {
     if (JobsUtility.JobWorkerCount > 0)
     {
         savedJobWorkerCount = JobsUtility.JobWorkerCount;
         try
         {
             JobsUtility.JobWorkerCount = 0;
         }
         catch (System.ArgumentOutOfRangeException e) when(e.ParamName == "JobWorkerCount")
         {
             UnityEngine.Debug.LogWarning("Disabling Job Threads requires Unity Version 2020.1.a15 or newer");
         }
     }
     else
     {
         JobsUtility.JobWorkerCount = savedJobWorkerCount;
         if (savedJobWorkerCount == 0)
         {
             JobsUtility.ResetJobWorkerCount();
         }
     }
 }