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
- Physics SyncColliders 3x-7x performance regression from 2022LTS to U6
- ListView's '+' button causes a recursively dispatching event when the visual element area is filled up
- Soft keyboard closes immediately after multiple touches are made if Pointer Behavior is set to SingleUnifiedPointer
- UI Image batching breaks when interleaving elements with mixed z-positions and materials
- KeyNotFoundException is thrown when retrieving some values from HyperLinkClickedEventArgs
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).