Search Issue Tracker
Won't Fix
Votes
0
Found in
5.4.2p4
Issue ID
855522
Regression
No
Agent does not plan shortest path
How to reproduce:
1. Open attached project
2. Open scene test.unity
3. Open the Navigation window
4. Play the scene
5. Select the Agent gameobject
- Note how the navigation debug view displays the planned path to be along the edge of the path
- Moving the Agent around using the transform handles in the scene view causes the path to be recalculated into the actual shortest path
- Reproduced in 5.4.3p1 (00292ff31167), 5.5.0f3 (1d1a0b50d15c), 5.6.0a6 (af2099d5a7ac)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note (2021.2.X):
As a performance optimization, the current implementation of the Navigation system does not guarantee that the path found towards the destination is always the shortest one (i.e. optimal). To compensate for this limitation the NavMeshAgent will try to optimize the path regularly as it moves towards its destination. Overall, this technique aims to reduce the movement of the agent to the minimum, but it does not guarantee that the reported NavMeshAgent.path will be the shortest one at any given time.
In the cases when the path found through a section of the NavMesh (the game environment) is repeatedly sub-optimal, it is recommended to slightly change the environment geometry in that area such that the NavMesh geometry improves. In turn this will increase the chances of obtaining the shortest path. The geometry of the NavMesh can produce better paths when it does not contain long, thin polygons. Please try to tweak the factors that influence the creation of such triangles. They can be: excessive detail of the obstacle geometry (at the border of the NavMesh), or a low value for the "voxel size" parameter (often used for increasing the accuracy of the NavMesh).