void OnEnable() { Seeker seeker = GetComponent <Seeker>(); seeker.pathCallback = OnPathComplete; // Create a new XPath with a custom ending condition XPath p = XPath.Construct(transform.position, targetPoint.position, null); p.endingCondition = new CustomEndingCondition(p, hLimit); p.endingCondition = new DistanceEndingCondition(p, _maxDistance); //p.endingCondition = new EndingConditionProximity(p, _maxDistance); // Draw a line in black from the start to the target point Debug.DrawLine(transform.position, targetPoint.position, Color.black); seeker.StartPath(p); }