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
- Crash on "The GUID inside 'Assets/asset.png.meta' cannot be extracted by the YAML Parser." when opening the project
- Shadows disappear when looking at a certain angle in Scene view and using Cloud Shadows with Volumetric Clouds
- StackOverflowException freezes or silently crashes the Editor
- Microsoft Surface Device freezes when detaching and reattaching physical keyboard attachment to a Microsoft Surface device in Standalone Player for Windows
- Shadows are cast with artifacts on GameObjects when the light type is set to Point
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.