A* Pathfinding Project

Enemy Draws path once then stops


#1

(Not sure if this is the right place to go)


Capture3

The enemy draws the path, but then doesn’t follow it and the path doesn’t change when the target moves.
Earlier I was getting an error about how the path was cancelled because another one was started before it finished. To solve this, I put:

*if (seeker.IsDone())** {
seeker.StartPath (transform.position, target.position, OnPathComplete);

yield return new WaitForSeconds ( 1f/updateRate );
StartCoroutine (UpdatePath());
}

Did I mess something up and is there a simple way to fix it? I can upload any other info that somebody needs to help


#2

Hi

Sorry for the late answer. I have been traveling and have not been able to answer support requests for some time.
That looks correct as far as I can see. Can you see in the log that paths are being calculated?


#3

Log as in the unity error console or a different thing? The unity log says absolutely nothing… I might have changed a setting or something that screwed it up.


#4

Are you running this in the editor or in a standalone game?
You can enable path logging in A* Inspector -> Settings -> Path Log Mode.

Oh, also.
Note that in your code if the seeker is at any time not done then the coroutine will never run again. This is most likely what is causing problems for you.