void OnDrawGizmosSelected() { if (!_drawConnections) { return; } var drawablePoints = new List <GameObject>(); foreach (var obj in GameObject.FindGameObjectsWithTag("Waypoint")) { if (obj.activeInHierarchy) { drawablePoints.Add(obj); } } foreach (var obj in GameObject.FindGameObjectsWithTag("PatrolPoint")) { if (obj.activeInHierarchy) { drawablePoints.Add(obj); } } foreach (var obj in drawablePoints) { if (obj.CompareTag("Waypoint")) { Gizmos.color = Color.white; } else if (obj.CompareTag("PatrolPoint")) { Gizmos.color = Color.yellow; } if (VisibilityGraph.CanPointsSeeEachOther(transform.position, obj.transform.position)) { Gizmos.DrawLine(transform.position, obj.transform.position); } } }