You can subclass the AIPath component if you want. You can also subclass its editor script.
However, I recommend trying to interact with the AIPath component via separate scripts as much as possible, instead of subclassing.
If you want the agent to stop at a specific point, then set that point as the agent’s destination.
“Thank you very much! The last question is, how can I find the closest path to an object from the player? Since the object has a collider, I can’t navigate directly to the center, and the closest point in a straight line between the player and the object may not be the nearest due to obstacles. My idea is to generate a point every 10° around the object’s radius and then determine which of these 36 points is the closest. Is there a better approach?”
Typically, a heuristic of “just move the destination ever so slightly closer to the agent” works just fine.
But otherwise you can do what you describe with a MultiTargetPath.
Hello, I tried using the method you mentioned to determine if a point is reachable, but sometimes it still ends up on the edge, preventing the movement from being completed. I would like to ask if there’s a way to detect when the character is stuck and unable to move? I want to use this method to find another point to move to when this happens.