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
- [Android][Sentis] Human poses are not detected when using the BlazePose model
- Sprite Editor Outline Tool Overlay is not displayed when no Sprite is selected
- “No method with RuntimeInitializeOnLoadMethod attribute” warning from ReadmeEditor.cs is thrown after installing Project Auditor Rules
- Projection matrix is altered when using RasterCommandBuffer.ClearRenderTarget on DX12 and Metal
- Entities Hierarchy window allows Cyclic nesting and throws an “ArgumentException: Cyclic nesting detected” error when dragging a Prefab onto the same Prefab in the Entities Hierarchy
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.