public void GeneralScan(List <Unit> foundUnits, UnitTags unitTags) { int foundCollidersCount = Physics2D.OverlapCircleNonAlloc(_unit.MoveController.Body.position, _visionRange, _foundColliders, _targetLayers); foundUnits.Clear(); for (int i = 0; i < foundCollidersCount; i++) { Collider2D collider = _foundColliders[i]; Unit unit = collider.GetComponent <Unit>(); if (unit != null && unit != _unit) { if (UnitUtils.ContainsTag(unit.UnitTags, unitTags) && Scan(unit, _unit.MoveController.Body.transform, _visionRange, _visionLayers, _visionAngle)) { foundUnits.Add(unit); } } } }