void Start() { pathfindingQueue = new List <Pursuer>(); PathHandler.Init(cellMinSize * .25f); switch (threadsCountMode) { case 0: allowedProcessorCoresCount = maxPossibleProcessorCores; break; case 1: allowedProcessorCoresCount = Mathf.CeilToInt(Environment.ProcessorCount * coresCountMultiplier); break; case 2: break; default: break; } allowedProcessorCoresCount = Mathf.Min( Mathf.Max(allowedProcessorCoresCount, 1), // To not be less than 1 maxPossibleProcessorCores); // To not be more than the number of available processor cores. pathfindingTasksCountLimit = allowedProcessorCoresCount; if (obtainGraphAtStart) { cTSInstance = new CancellationTokenSource(); PrimaryProcessing(); } }