Hi all, we are an indie team (hobbyists), and we are trying to adapt a project of ours to use A* Pathfinding Project.
Our situation is this: we have a script that generates a procedural dungeon (of connected rooms). We added a preconfigured grid graph to our basic scene (it’s all red blocks initially, because there’s nothing before the script generates the map).
Once a map is generated, we have noticed that A* makes an automatic scan() by itself, without it being called by any script. Don’t know if this is intended or not, but we get our navigation mesh correctly configured on top of our randomly generated map, so that’s good.
The player controlled unit uses, for the moment, the AstarAI.cs default script. We only modified it in order to get the targetDestination for the seeker.StartPath function from the mouse click. The code is simply like this:
public void Update()
{
if (Input.GetMouseButtonDown(0))
{
Ray ray = playerCamera.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, 100))
{
seeker.StartPath(transform.position, hit.point, OnPathComplete);
}
}
}
On a test plane it works flawlessly, the PC goes where you click, drawing the path.
But on one of our random generated maps, the PC moves only 1 pixel in the indicated direction, and then stops suddenly, with the console spamming “End Of Path Reached” in loop, even though it only moved 1 millimiter. The drawn path also appears to be broken, starting a little ahead of the player position, and ending a little before the supposed end position.
PS: we also noticed that sometimes the RAM usages goes from 2 to 8 real quick, and stays there until you reboot unity. For info: the grid graph generated is 204x204 nodes (0.5 size).
Hope someone is willing to help us troubleshoot.
I’m available to provide any evidence if needed.
Thanks.