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
- Mono Windows Builds don't produce full log callstacks when generating logs
- AssetBundles fail to load when running in Built Players for Mobile Devices
- UI elements with text gets bigger and grey when Player window is moved to another screen with different resolution
- System name accepts multiline text but crops it on confirmation, duplicates input, and shrinks the field when empty
- UI element scale and position are wrong in project build when DRS is changed with HDR and Software Dynamic Resolution enabled
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.