void selectTargetNode() { selectTargetTransform(); if (_targetTransform == null) { return; } TargetNodes targetNodes = _targetTransform.GetComponent <TargetNodes>(); Pathfinding.GraphNode targetNode = targetNodes.GetClosestNode(_transform.position); if (targetNode == null) { return; } _aiPath.destination = (Vector3)targetNode.position; }