Search Issue Tracker
By Design
Votes
1
Found in
2019.3.0a1
2019.4.5f1
2020.1
2020.2
Issue ID
1268136
Regression
Yes
Raycast will not hit a GameObject after certain amount of hits elsewhere when the GameObject has Nav Mesh Agent and Rigidbody
How to reproduce:
1. Open user's attached "Find a Bug" project
2. Open the "SampleScene" Scene
3. Enter the Play Mode
4. Left-click with the mouse on the "Hero 1" GameObject
5. Left-click with the mouse on the "Ground" GameObject 50 times
6. Left-click with the mouse on the "Hero 1" GameObject
Expected result: The "Hero 1" GameObject is selected, turns blue
Actual result: The "Hero 1" GameObject is not selected, doesn't turn blue
Reproducible with: 2019.3.0a1, 2019.4.8f1, 2020.1.3f1, 2020.2.0a21
Not reproducible with: 2018.4.26f1, 2019.2.21f1
Notes:
- Only reproducible if the GameObject that needs to be hit has Nav Mesh Agent and Rigidbody components even if they are not used, removing/disabling any one of them stops the issue from happening
- Sometimes you might still be able to select the "Hero 1" GameObject after 50 clicks elsewhere, keep on clicking on the "Hero 1" then "Ground" back and forth and eventually the "Hero 1" GameObject will not be hit by the Raycast
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
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Resolution Note:
As mentioned in the manual here: https://docs.unity3d.com/Manual/nav-MixingComponents.html, combining a DYNAMIC Rigidbody and a NavMeshAgent on the same game object is an undefined behavior. If you enable the physics debugger, you can see that the actual physics body is sinking down under the ground because AI and Physics fight each other over the control of the same object.
Please set the Rigidbody to KINEMATIC as it is the only option to make it work well with the NavMeshAgent.
Alternatively make sure to have only one of the Rigidbody and NavMeshAgent components active at any one time.