I am using this tool in my game for the first time. The game is set on a globe, so I made a spherical graph with the globes mesh. I used the A*Projects documentation examples to make my own AstarAI script to get a path and follow it.
In the Editor, everything works perfectly fine and the enemy is chasing the player around the entire globe while avoiding obstacles. However, when building the project the enemy behaves as usual but does not move via pathfinding.
Using Debug.Log I found the reason: In the Build the path.errorLog reports that he “Can’t find a node close to the start Point”, while he has no problems to do that in the editor.
I can’t wrap my head around what could cause this and attached some settings for context.
The Settings of my Spherical Pathfinder Graph, using the spheres Mesh. Recalculate Normals is deactivated because its a sphere. Tried checking Nearest node queries in XZ space for fun but it does not change anything.
The enemies gameobject sits exactly on the spherical-graphs surface and should have no problems finding a node (and has none in the editor). It has a collider attached that overlaps the ground, but its not a navMeshCut so it should not make any problems. The enemy is ca 1.5 units long for reference.
Maybe someone encountered this before and/or knows a solution.
Have you checked to make sure there are no other error messages earlier in the log?
I’m not sure what could cause this.
When using Debug.Log to print the path.errorLog it only showed me this. There were no other error messages, but I will check and attach some more debugs again on Monday. If only debugging in build mode wasn’t so tedious… :.)
Alright, I checked it again, there are no other errors or warnings in my scene. After disabeling normal logs for clarity the only Log Output in the Build I got looked like this:
Not getting the start node when checking every 0.5 seconds seems to be the only point of failure, as all of my AI behaviours are still excuted normally. The location it is trying to get to is also plausible.
Is the error with the mesh? The game is set on a sphere with a radius of 100 units having a triangular mesh. When I click scan in the editor where its working the NavMesh looks like this (fyi you can see the triangles of the opposite side as well).
I am still rather inexperienced with coding so my best guess right now would be that there is a problem with how the mesh is loaded while building…? If this error persists i will have to find another way of making spherical pathfinding work. I was happy to get it running in the first place so help would be appreciated…
I have some new info!
I tried to figure out your code as best as I can and added an errorlog message to NNInfo so i can manually try to call GetClosest in AstarPath.active and check why it does not return a node.
The result is that graphsArray is declared, the graph i made has been found but its NodeCount is 0!
I tried testing it like this on Start and a second later while it was already running, but the result is the same.
When I remove my mesh from the Graph in the editor it shows the same behaviour, so I presume that the graph just has no mesh in the build. This is how said mesh looks in ProjectView is anything wrong with it?
Can you log the result of
AstarPath.active.data.navmeshGraph.mesh in your game and see if it manages to find the mesh?
Do you have any other meshes named “default” in your project? Is the mesh read only?
Hey, thanks for replying. It was very irritating but I was able to fix it!
I did what you said and checked for AstarPath.active.data.navmesh.sourceMesh and it was there. So I ckecked for the vertice count and it said 0 in build. I then did a lot of editor/build comparison and enabled/disabled Version control (perforce). Apparently when the mesh got imported it only saved the original import settings when adding and perforce was told to ignore the updated files for that. It always reset them when building the project causing them to be readonly only in build… I just had to reimport while offline identify where it was saved and make an exception for perforce…
It was a simple issue caused by a rather irritating version control fuckup.
Thank you so much for yout time! Now that I got it to work your pathfinding project is amazing and a great help!