Recalculate path when target moves

The script I have so far shows the path to the target and updates if the transform (enemy) moves but when the target moves.

How would I recalculate the path when the target has moved?

Hi

Usually movement scripts repeatedly recalculate the path every X seconds.
Take a look at the AIPath script included in the project. That component has repathRate which is how often it should recalculate the path.

Excuse my derppy capitalization, I don’t have anything to check on hand exactly what the method names are called :stuck_out_tongue:

Sudo code:

`CheckShit(){
    If(target.position =! MyPath.VectorPath[Somepath.Count-1]){
        GetNewPath(target.position);
    }`

Thank you for your replies. I now have a working script but I do have a problem. The script uses the Seeker script so when I run another script a error message displays saying “Canceled path because a new one was requested”.

I assume only one script can only run using the Seeker script? Or will I have to integrate both scripts into one?

Yes, you only one can path on a seeker at a time :: but you can always just call a new ABPath(See Documentation here)