Search Issue Tracker
By Design
By Design in 2023.2.X
Votes
0
Found in
2020.3.45f1
2021.3.20f1
2022.2.9f1
2023.1.0b6
2023.2.0a4
Issue ID
UUM-28417
Regression
No
Phsyics.Raycast throws a NullReferenceException when used without the maxDistance argument
Reproduction steps:
1. Open the attached “Repro.zip” project
2. Open the “Assets/Scenes/Puzzle.unity” Scene
3. Enter the Play Mode
4. Press on the Rubik's Cube on the left side of the Game View
5. Observe the Console
6. Press on any of the white cubes on the right side of the Game View
7. Observe the Console
Expected result: No errors are present and “Hit something in the Input Layer” is printed in the Console
Actual result: NullReferenceException is thrown and “Hit something in the Cube Layer” is printed in the Console
Reproducible with: 2020.3.45f1, 2021.3.20f1, 2022.2.9f1, 2023.1.0b6, 2023.2.0a4
Reproducible on: Windows 10 (21H2)
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
- Texture generator reference image fails despite valid size
- Agent mode can enter infinite execution loop
- AI Gateway responses contain duplicated sentences
- Texture 2D asset is created when promoting a generated Cubemap to a new asset
- Unable to copy multiple paragraphs from Assistant responses
Resolution Note:
Physics.Raycast doesn't throw the exception here, a user script that looks for a component after registering a hit does.
Also the LayerMask is being passed as maxDistance, that's why the raycast is returning an unexpected hit.
Resolution Note (2023.2.X):
Physics.Raycast doesn't throw the exception here, a user script that looks for a component after registering a hit does.
Also the LayerMask is being passed as maxDistance, that's why the raycast is returning an unexpected hit.