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
- Bunch of "TargetParameterCountException" errors thrown in the Editor Console when opening the "Adaptive Probe Volumes" tab in the "Lighting" window
- Non-removable serialized data for a renderer feature still appears even when the renderer feature is deleted
- URP Cascaded Shadows do not have a falloff in Player when the Player is built not in Development Mode
- Grid in animation preview window is rendered on top of the object
- WebGPU Graphics.RenderPrimitives fails on MeshTopology.Quads with Validation errors when exceeding 64k vertices
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.